diff --git a/Syntaxes/Apple III Business BASIC.sublime-syntax b/Syntaxes/Apple III Business BASIC.sublime-syntax index e103a2e..bb075bf 100644 --- a/Syntaxes/Apple III Business BASIC.sublime-syntax +++ b/Syntaxes/Apple III Business BASIC.sublime-syntax @@ -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*(?=\()' diff --git a/Syntaxes/Applesoft.sublime-syntax b/Syntaxes/Applesoft.sublime-syntax index a763e5f..3b45c51 100644 --- a/Syntaxes/Applesoft.sublime-syntax +++ b/Syntaxes/Applesoft.sublime-syntax @@ -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) diff --git a/Syntaxes/EhBasic.sublime-syntax b/Syntaxes/EhBasic.sublime-syntax new file mode 100644 index 0000000..6d80ebb --- /dev/null +++ b/Syntaxes/EhBasic.sublime-syntax @@ -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 \ No newline at end of file diff --git a/Syntaxes/GSoft.sublime-syntax b/Syntaxes/GSoft.sublime-syntax index 91ea724..f1c1713 100644 --- a/Syntaxes/GSoft.sublime-syntax +++ b/Syntaxes/GSoft.sublime-syntax @@ -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]+' diff --git a/Syntaxes/Integer BASIC.sublime-syntax b/Syntaxes/Integer BASIC.sublime-syntax index 5f01e68..5d95374 100644 --- a/Syntaxes/Integer BASIC.sublime-syntax +++ b/Syntaxes/Integer BASIC.sublime-syntax @@ -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' diff --git a/Syntaxes/MD-BASIC.sublime-syntax b/Syntaxes/MD-BASIC.sublime-syntax index 2b87e71..c38ee8a 100644 --- a/Syntaxes/MD-BASIC.sublime-syntax +++ b/Syntaxes/MD-BASIC.sublime-syntax @@ -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 diff --git a/Syntaxes/MPW Integer Basic.sublime-syntax b/Syntaxes/MPW Integer Basic.sublime-syntax index e1ee3c8..da589ab 100644 --- a/Syntaxes/MPW Integer Basic.sublime-syntax +++ b/Syntaxes/MPW Integer Basic.sublime-syntax @@ -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 diff --git a/Syntaxes/ORCA Integer Basic.sublime-syntax b/Syntaxes/ORCA Integer Basic.sublime-syntax index 4408fe3..34184b5 100644 --- a/Syntaxes/ORCA Integer Basic.sublime-syntax +++ b/Syntaxes/ORCA Integer Basic.sublime-syntax @@ -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 diff --git a/info.plist b/info.plist index bf36fd8..d23f77e 100644 --- a/info.plist +++ b/info.plist @@ -9,7 +9,7 @@ description Miscellaneous Apple II BASIC dialects. name - BASIC + Apple II BASIC uuid 66C85DF0-E5F1-4EB2-8E79-7BB29DE7ECA4