SACS syntax

Bentley’s SACS is the other suite I often use at work. So in the tradition of improving one’s own work environment, I extended syntax-highlighting for SACS input files with this public repository sacs_st. Here is a view of a couple of files syntax-highlighted in Sublime Text.

SACS input file syntax-highlighted in Sublime Text.
SACS input file syntax-highlighted in Sublime Text.

Ensure SACS input files end with .inp for syntax highlighting to work.

With this package now available from Package Control, sacs_st can be installed from directly within Sublime Text. Here is how:

  1. From Tools, select Install Package Control… (Skip if already installed.)
  2. From Preferences > Package Control > Install Package, search for sacs and select.

Trivia

SACS commands are spread across its numerous manuals, and so it was an interesting exercise in amassing them all into a list first, and then sort them to remove duplicates. But before doing so, I wanted to see which ones were repeated. So I wrote this script to find out:

#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Find most common sacs commands across modules
# 2020 ckunte

import re
from collections import Counter

# read a file containing all sacs commands
commands = re.findall(r'\w+', open('sacs-commands-all.txt').read())

# print 85 most common commands across all sacs modules
mcom = Counter(commands).most_common(85)
for com, nos in mcom:
    print("{:<12}{:<9}".format(com, nos))

The number 85 in the code above is arbitrary. I tried a few others before like 100, 90, until single occurrences of commands reduced to just a couple. Now that I think of it, there is an even simpler way to sort unique list of commands using chained shell commands like so:

curl https://gist.githubusercontent.com/ckunte/d4bd35e2ac07dc6d575d95c60a61a8ef/raw/07cdd051893455544cac2185c08a83aab3e468e1/sacs-commands-all.txt | sort | uniq -c | sort -nr | grep -v "#"