st3 updates

This commit is contained in:
Kelvin Sherlock 2018-09-03 15:07:18 -04:00
parent 39d08b4108
commit 43da41e734
9 changed files with 195 additions and 45 deletions

View File

@ -13,14 +13,22 @@ contexts:
captures:
0: keyword.function
1: entity.name.function
- match: '"'
scope: punctuation.definition.string.begin
push:
- meta_scope: string.quoted.double
- match: '"'
scope: punctuation.definition.string.end
pop: true
- match: \b(?i:REM)\b.*$
- match: '\b(?i:REM)\b'
comment: "may end at : ?"
scope: comment.line
push:
- meta_scope: comment.line
- match: '\n'
pop: true
- match: '(\d+\.\d*|\.\d+|\d+)([eE][+-]?\d+)?'
scope: constant.numeric
- match: '\b(?i:FN)\s*([A-Za-z][A-Za-z0-9.]*)\s*(?=\()'

View File

@ -16,15 +16,23 @@ contexts:
0: keyword.function
1: entity.name.function
2: variable.parameter
- match: '"'
scope: punctuation.definition.string.begin
push:
- meta_scope: string.quoted.double
- match: '"'
scope: punctuation.definition.string.end
pop: true
- match: (?i:shload|load|recall|save|store)
scope: invalid.deprecated
- match: (?i:rem).*$
scope: comment.line
- match: (?i:rem)
push:
- meta_scope: comment.line
- match: '\n'
pop: true
- match: '\d+|\d*\.\d*([eE][+-]?\d+)?'
scope: constant.numeric
- match: (?i:goto|onerr|on|if|then|for|to|step|next|gosub|return|pop|resume|stop|del|end|wait)

View File

@ -0,0 +1,91 @@
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: EhBASIC
file_extensions: []
scope: source.ehbasic
variables:
ident: '[A-Za-z][A-Za-z0-9]*'
contexts:
main:
- match: ^\d+
scope: entity.name.function
- match: '%[01]+\b'
scope: constant.numeric.binary
- match: '\$[0-9A-Fa-f]+\b'
scope: constant.numeric.hexadecimal
- match: '(\d+\.\d*|\.\d+|\d+)([eE][+-]?\d+)?'
scope: constant.numeric
- match: '"'
scope: punctuation.definition.string.begin
push:
- meta_scope: string.quoted.double
- match: '"'
scope: punctuation.definition.string.end
pop: true
- match: '\b(DEF\s+FN)\s*({{ident}})\b'
scope: meta.def.fn
captures:
0: keyword.function
1: entity.name.function
- match: '\bREM\b'
push:
- meta_scope: comment.line
- match: '\n'
pop: true
- match: '\b(ON)\s+(IRQ|NMI)\b'
captures:
0: keyword.command
1: keyword.command
- match: '\b(BITCLR|BITSET|CALL|DEC|DEF|DOKE|FN|INC|POKE|SWAP)\b'
scope: keyword.command
- match: '\b(CLEAR|DIM|LET)\b'
scope: keyword.variable
- match: '\b(GET|INPUT|PRINT|READ|RESTORE|DATA|RESTORE|SPC|TAB|WIDTH|NULL)\b'
scope: keyword.command.io
- match: '\b(DO\ELSE|FOR|GOSUB|GOTO|IF|THEN|LOOP|UNTIL|WHILE|NEXT|ON|RETIRQ|RETNMI|RETURN|STEP|STOP|END|WAIT)\b'
scope: keyword.control
- match: '\b(AND|EOR|OR|NOT)\b'
scope: keyword.operator
- match: '\b(ABS|ASC|ATN|BITTST|COS|DEEK|EXP|FRE|INT|LEN|LOG|MAX|MIN|PEEK|POS|RND|SADD|SGN|SIN|SQR|TAN|USR|VAL|VARPTR)\b'
scope: support.function
- match: '\b(BIN|HEX|LCASE|LEFT|MID|RIGHT|STR|UCASE|CHR)\$'
scope: support.function
- match: '\b(PI|TWOPI)\b'
scope: constant.support
- match: '\b(CONT|LIST|NEW|RUN|LOAD|SAVE)\b'
scope: keyword.command.immediate
- match: '\b(IRQ|NMI)\b'
scope: keyword.command
push:
- match: '\b(ON|OFF|CLEAR)\b'
scope: constant.language
pop: true
- match: '$'
pop: true
- match: '\S+'
scope: invalid.illegal
pop: true
- match: '\b{{ident}}\$'
scope: variable.string
- match: '\b{{ident}}\b'
scope: variable

View File

@ -24,13 +24,21 @@ contexts:
captures:
0: keyword.function
1: entity.name.function
- match: '"'
scope: punctuation.definition.string.begin
push:
- meta_scope: string.quoted.double
- match: '"'
scope: punctuation.definition.string.end
pop: true
- match: '!.*$|\b(?i:rem)\b.*$'
scope: comment.line
- match: '!.*$|\b(?i:rem)\b'
push:
- meta_scope: comment.line
- match: '\n'
pop: true
- match: '(\d+\.\d*|\.\d+|\d+)([eE][+-]?\d+)?'
scope: constant.numeric
- match: '\$[A-Fa-f0-9]+'

View File

@ -8,13 +8,20 @@ contexts:
main:
- match: ^\d+
scope: entity.name.function.line-number
- match: \b(?i:rem).*$
scope: comment.line
- match: \b(?i:rem)
push:
- meta_scope: comment.line
- match: '\n'
pop: true
- match: '"'
scope: punctuation.definition.string.begin
push:
- meta_scope: string.quoted.double
- match: '"'
scope: punctuation.definition.string.end
pop: true
- match: '\b(?i:goto|if|then|for|to|step|next|gosub|return|pop|stop|con|end)(?![$])\b'
scope: keyword.control
- match: '\b(?i:list)(?![$])\b'

View File

@ -25,28 +25,35 @@ contexts:
scope: constant.numeric.hex.md-basic
- match: '\d+|\d*\.\d*([eE][+-]?\d+)?'
scope: constant.numeric
- match: "'"
push:
- meta_scope: comment.line.md-basic
- match: \n
pop: true
push: comment
- match: '\b(?i:rem)(?![%$])\b'
push:
- meta_scope: comment.line
- match: \n
pop: true
push: comment
- match: "`"
scope: punctuation.definition.string.begin
push:
- meta_scope: string.quoted.raw
- match: "`"
scope: punctuation.definition.string.end
pop: true
- match: '"'
scope: punctuation.definition.string.begin
push:
- meta_scope: string.quoted.double.md-basic
- match: '"'
pop: true
- meta_scope: string.quoted.double
- match: '\^.'
scope: constant.character.escape.md-basic
- match: '$'
scope: invalid.illegal
pop: true
- match: '"'
scope: punctuation.definition.string.end
pop: true
- match: '\b(?i:goto|onerr|on|if|then|for|to|step|next|gosub|return|pop|resume|stop|del|end|wait)(?![%$])\b'
scope: keyword.control
- match: '\b((?i)do|else|endif|loop|repeat|until|wend|while)(?![%$])\b'
@ -84,45 +91,50 @@ contexts:
scope: keyword.operator.logical
- match: '\b(?i:true|false|__mdbasic__)(?![%$])\b'
scope: constant.language.md-basic
- match: ^\s*#\s*(include)\s+
- match: ^\s*(#\s*include)\b
captures:
1: keyword.control.import.include.md-basic
push:
- meta_scope: meta.preprocessor.md-basic.include
- match: (?=(?://|/\*))|$
captures:
1: keyword.control.import.include.md-basic
pop: true
- match: (?>\\\s*\n)
scope: punctuation.separator.continuation.md-basic
- meta_scope: meta.preprocessor.include.md-basic
- match: '"'
captures:
0: punctuation.definition.string.begin.md-basic
push:
scope: punctuation.definition.string.begin.md-basic
set:
- meta_scope: string.quoted.double.include.md-basic
- match: '"'
captures:
0: punctuation.definition.string.end.md-basic
scope: punctuation.definition.string.end.md-basic
pop: true
- match: <
captures:
0: punctuation.definition.string.begin.md-basic
push:
- match: '<'
scope: punctuation.definition.string.begin.md-basic
set:
- meta_scope: string.quoted.other.lt-gt.include.md-basic
- match: ">"
captures:
0: punctuation.definition.string.end.md-basic
- match: '>'
scope: punctuation.definition.string.end.md-basic
pop: true
- match: '^\s*#\s*(define)\s*([A-Za-z_][A-Za-z_0-9]*)'
- match: '\S+'
scope: invalid.illegal
pop: true
- match: '^\s*(#\s*define)\s*([A-Za-z_][A-Za-z_0-9]*)'
scope: meta.preprocessor.macro.md-basic
captures:
1: keyword.control.import.define.md-basic
2: entity.name.function.preprocessor.md-basic
- match: ^\s*#\s*(?i:declare|define|else|endif|error|if|ifdef|ifndef|include|pragma|print|reserve)\b
scope: meta.preprocessor
- match: '&\s*([A-Za-z_][A-Za-z0-9_]*)'
scope: support.function.ampersand
- match: "[A-Za-z_][A-Za-z0-9_]*[$%]?"
comment: uses non-greedy *? so keywords get a first shot
scope: variable
comment:
- meta_scope: comment.line
- match: \n
pop: true

View File

@ -20,13 +20,21 @@ contexts:
captures:
0: keyword.control
1: support.function
- match: '"'
scope: punctuation.definition.string.begin
push:
- meta_scope: string.quoted.double
- match: '"'
scope: punctuation.definition.string.end
pop: true
- match: \b(?i:rem)\b.*$
scope: comment.line
- match: \b(?i:rem)\b
push:
- meta_scope: comment.line
- match: '\n'
pop: true
- match: \d+
scope: constant.numeric
- match: \b(?i:CALL|END|FOR|GOSUB|GOTO|IF|NEXT|POP|RETURN|STEP|THEN|TO)\b

View File

@ -14,13 +14,21 @@ contexts:
captures:
0: keyword.control
1: support.function
- match: '"'
scope: punctuation.definition.string.begin
push:
- meta_scope: string.quoted.double
- match: '"'
scope: punctuation.definition.string.end
pop: true
- match: \b(?i:rem)\b.*$
scope: comment.line
- match: \b(?i:rem)\b
push:
- meta_scope: comment.line
- match: '\n'
pop: true
- match: \d+
scope: constant.numeric
- match: \b(?i:CALL|END|FOR|GOSUB|GOTO|IF|NEXT|POP|RETURN|STEP|THEN|TO)\b

View File

@ -9,7 +9,7 @@
<key>description</key>
<string>Miscellaneous Apple II BASIC dialects.</string>
<key>name</key>
<string>BASIC</string>
<string>Apple II BASIC</string>
<key>uuid</key>
<string>66C85DF0-E5F1-4EB2-8E79-7BB29DE7ECA4</string>
</dict>