%YAML 1.2 --- # See http://www.sublimetext.com/docs/3/syntax.html # put into ~/.config/sublime-text-3/Packages/User name: 'SolO Level 3' file_extensions: - l3 scope: source.l3 variables: digitpart: (?:\d(?:_?\d)*) contexts: main: - include: numbers - match: '"""' scope: punctuation.definition.comment.l3 push: line_comment # Strings begin and end with quotes, and use backslashes as an escape # character - match: '"' scope: punctuation.definition.string.begin.l3 push: double_quoted_string # Comments begin with a '#' and finish at the end of the line - match: '#' scope: punctuation.definition.comment.l3 push: line_comment # functions - match: '\$(log2|power|floor|ceil|LOGR|LOG|def)' scope: support.function.l3 # macrovars - match: '(\$\{[0-9a-zA-Z.]*\}|\$[0-9a-zA-Z.])' scope: constant.language.l3 # conditional - match: '\b(if1|ifS|ifC|ifN)\b' scope: keyword.operator.l3 # opcodes - match: '\b(ADDI|ADD|BITC|BITS|BRNG|CMP|GOTO|HISTS|HIST|LOG|MULI|NOP|PHA|POKE|STOP|SUB|TRIM)\b' scope: entity.name.tag.l3 # Directives - match: '\.(include|forwardfile|forward|name|version|print|ifdef|ifndef|if|elseif|else|endif|call|macro|endmacro|for|endfor|loop|endloop|var|endvar|undef)\b' scope: keyword.control.l3 double_quoted_string: - meta_scope: string.quoted.double.l3 - match: '\\.' scope: constant.character.escape.l3 - match: '"' scope: punctuation.definition.string.end.l3 pop: true line_comment: - meta_scope: comment.line.l3 - match: $ pop: true # copied from the python syntax file numbers: # https://docs.python.org/3/reference/lexical_analysis.html#numeric-literals # hexadecimal - match: \b(?i)(?:0x\h*)(L) # py2 scope: constant.numeric.integer.long.hexadecimal.python captures: 1: storage.type.numeric.long.python - match: \b(?i)(0x(_?\h)+) scope: constant.numeric.integer.hexadecimal.python # octal - match: \b(?i)0(?:o|[0-7])[0-7]*(L) # py2 scope: constant.numeric.integer.long.octal.python captures: 1: storage.type.numeric.long.python - match: \b(?i)0[0-7]+ # py2 scope: constant.numeric.integer.octal.python - match: \b(?i)0o(_?[0-7])+ scope: constant.numeric.integer.octal.python # binary - match: \b(?i)0b[01]*(L) # py2 scope: constant.numeric.integer.long.binary.python captures: 1: storage.type.numeric.long.python - match: \b(?i)0b(_?[01])* scope: constant.numeric.integer.binary.python # complex - match: (?i){{digitpart}}?(\.){{digitpart}}(?:e[\-\+]?{{digitpart}})?(j) # mandatory fraction scope: constant.numeric.complex.python captures: 1: punctuation.separator.decimal.python 2: storage.type.numeric.complex.python - match: \b(?i)(?:{{digitpart}}(?:(\.){{digitpart}}?)?|(\.){{digitpart}})(?:e[\-\+]?{{digitpart}})(j) # mandatory exponent scope: constant.numeric.complex.python captures: 1: punctuation.separator.decimal.python 2: punctuation.separator.decimal.python 3: storage.type.numeric.complex.python - match: (?i){{digitpart}}(\.)?(j) # mandatory digitpart scope: constant.numeric.complex.python captures: 1: punctuation.separator.decimal.python 2: storage.type.numeric.complex.python # floating point - match: (?i){{digitpart}}?(\.){{digitpart}}(?:e[\-\+]?{{digitpart}})? # mandatory fraction scope: constant.numeric.float.python captures: 1: punctuation.separator.decimal.python - match: \b(?i)(?:{{digitpart}}(?:(\.){{digitpart}}?)?|(\.){{digitpart}})(?:e[\-\+]?{{digitpart}}) # mandatory exponent scope: constant.numeric.float.python captures: 1: punctuation.separator.decimal.python 2: punctuation.separator.decimal.python - match: (?i){{digitpart}}(\.) # mandatory digitpart scope: constant.numeric.float.python captures: 1: punctuation.separator.decimal.python # integer - match: \b(?i)(?:[1-9]\d*|0)(L)\b # py2 scope: constant.numeric.integer.long.decimal.python captures: 1: storage.type.numeric.long.python - match: \b(?i)([1-9][\d_]*|0)\b scope: constant.numeric.integer.decimal.python