diff --git a/components.js b/components.js index 92a3883293..fff4655027 100644 --- a/components.js +++ b/components.js @@ -89,6 +89,10 @@ var components = { "require": "clike", "owner": "zeitgeist87" }, + "basic": { + "title": "BASIC", + "owner": "Golmote" + }, "brainfuck": { "title": "Brainfuck", "owner": "Golmote" diff --git a/components/prism-basic.js b/components/prism-basic.js new file mode 100644 index 0000000000..5fe20b0d8a --- /dev/null +++ b/components/prism-basic.js @@ -0,0 +1,14 @@ +Prism.languages.basic = { + 'string': /"(?:""|[!#$%&'()*,\/:;<=>?^_ +\-.A-Z\d])*"/i, + 'comment': { + pattern: /(?:!|REM\b).+/i, + inside: { + 'keyword': /^REM/i + } + }, + 'number': /(?:\b|\B[.-])(?:\d+\.?\d*)(?:E[+-]?\d+)?/i, + 'keyword': /\b(?:AS|BEEP|BLOAD|BSAVE|CALL(?: ABSOLUTE)?|CASE|CHAIN|CHDIR|CLEAR|CLOSE|CLS|COM|COMMON|CONST|DATA|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DIM|DO|DOUBLE|ELSE|ELSEIF|END|ENVIRON|ERASE|ERROR|EXIT|FIELD|FILES|FOR|FUNCTION|GET|GOSUB|GOTO|IF|INPUT|INTEGER|IOCTL|KEY|KILL|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|MKDIR|NAME|NEXT|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPTION BASE|OUT|POKE|PUT|READ|REDIM|REM|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SHARED|SINGLE|SELECT CASE|SHELL|SLEEP|STATIC|STEP|STOP|STRING|SUB|SWAP|SYSTEM|THEN|TIMER|TO|TROFF|TRON|TYPE|UNLOCK|UNTIL|USING|VIEW PRINT|WAIT|WEND|WHILE|WRITE)(?:\$|\b)/i, + 'function': /\b(?:ABS|ACCESS|ACOS|ANGLE|AREA|ARITHMETIC|ARRAY|ASIN|ASK|AT|ATN|BASE|BEGIN|BREAK|CAUSE|CEIL|CHR|CLIP|COLLATE|COLOR|CON|COS|COSH|COT|CSC|DATE|DATUM|DEBUG|DECIMAL|DEF|DEG|DEGREES|DELETE|DET|DEVICE|DISPLAY|DOT|ELAPSED|EPS|ERASABLE|EXLINE|EXP|EXTERNAL|EXTYPE|FILETYPE|FIXED|FP|GO|GRAPH|HANDLER|IDN|IMAGE|IN|INT|INTERNAL|IP|IS|KEYED|LBOUND|LCASE|LEFT|LEN|LENGTH|LET|LINE|LINES|LOG|LOG10|LOG2|LTRIM|MARGIN|MAT|MAX|MAXNUM|MID|MIN|MISSING|MOD|NATIVE|NUL|NUMERIC|OF|OPTION|ORD|ORGANIZATION|OUTIN|OUTPUT|PI|POINT|POINTER|POINTS|POS|PRINT|PROGRAM|PROMPT|RAD|RADIANS|RANDOMIZE|RECORD|RECSIZE|RECTYPE|RELATIVE|REMAINDER|REPEAT|REST|RETRY|REWRITE|RIGHT|RND|ROUND|RTRIM|SAME|SEC|SELECT|SEQUENTIAL|SET|SETTER|SGN|SIN|SINH|SIZE|SKIP|SQR|STANDARD|STATUS|STR|STREAM|STYLE|TAB|TAN|TANH|TEMPLATE|TEXT|THERE|TIME|TIMEOUT|TRACE|TRANSFORM|TRUNCATE|UBOUND|UCASE|USE|VAL|VARIABLE|VIEWPORT|WHEN|WINDOW|WITH|ZER|ZONEWIDTH)(?:\$|\b)/i, + 'operator': /<[=>]?|>=?|[+\-*\/^=&]|\b(?:AND|EQV|IMP|NOT|OR|XOR)\b/, + 'punctuation': /[,;:()]/ +}; \ No newline at end of file diff --git a/components/prism-basic.min.js b/components/prism-basic.min.js new file mode 100644 index 0000000000..f608570636 --- /dev/null +++ b/components/prism-basic.min.js @@ -0,0 +1 @@ +Prism.languages.basic={string:/"(?:""|[!#$%&'()*,\/:;<=>?^_ +\-.A-Z\d])*"/i,comment:{pattern:/(?:!|REM\b).+/i,inside:{keyword:/^REM/i}},number:/(?:\b|\B[.-])(?:\d+\.?\d*)(?:E[+-]?\d+)?/i,keyword:/\b(?:AS|BEEP|BLOAD|BSAVE|CALL(?: ABSOLUTE)?|CASE|CHAIN|CHDIR|CLEAR|CLOSE|CLS|COM|COMMON|CONST|DATA|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DIM|DO|DOUBLE|ELSE|ELSEIF|END|ENVIRON|ERASE|ERROR|EXIT|FIELD|FILES|FOR|FUNCTION|GET|GOSUB|GOTO|IF|INPUT|INTEGER|IOCTL|KEY|KILL|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|MKDIR|NAME|NEXT|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPTION BASE|OUT|POKE|PUT|READ|REDIM|REM|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SHARED|SINGLE|SELECT CASE|SHELL|SLEEP|STATIC|STEP|STOP|STRING|SUB|SWAP|SYSTEM|THEN|TIMER|TO|TROFF|TRON|TYPE|UNLOCK|UNTIL|USING|VIEW PRINT|WAIT|WEND|WHILE|WRITE)(?:\$|\b)/i,"function":/\b(?:ABS|ACCESS|ACOS|ANGLE|AREA|ARITHMETIC|ARRAY|ASIN|ASK|AT|ATN|BASE|BEGIN|BREAK|CAUSE|CEIL|CHR|CLIP|COLLATE|COLOR|CON|COS|COSH|COT|CSC|DATE|DATUM|DEBUG|DECIMAL|DEF|DEG|DEGREES|DELETE|DET|DEVICE|DISPLAY|DOT|ELAPSED|EPS|ERASABLE|EXLINE|EXP|EXTERNAL|EXTYPE|FILETYPE|FIXED|FP|GO|GRAPH|HANDLER|IDN|IMAGE|IN|INT|INTERNAL|IP|IS|KEYED|LBOUND|LCASE|LEFT|LEN|LENGTH|LET|LINE|LINES|LOG|LOG10|LOG2|LTRIM|MARGIN|MAT|MAX|MAXNUM|MID|MIN|MISSING|MOD|NATIVE|NUL|NUMERIC|OF|OPTION|ORD|ORGANIZATION|OUTIN|OUTPUT|PI|POINT|POINTER|POINTS|POS|PRINT|PROGRAM|PROMPT|RAD|RADIANS|RANDOMIZE|RECORD|RECSIZE|RECTYPE|RELATIVE|REMAINDER|REPEAT|REST|RETRY|REWRITE|RIGHT|RND|ROUND|RTRIM|SAME|SEC|SELECT|SEQUENTIAL|SET|SETTER|SGN|SIN|SINH|SIZE|SKIP|SQR|STANDARD|STATUS|STR|STREAM|STYLE|TAB|TAN|TANH|TEMPLATE|TEXT|THERE|TIME|TIMEOUT|TRACE|TRANSFORM|TRUNCATE|UBOUND|UCASE|USE|VAL|VARIABLE|VIEWPORT|WHEN|WINDOW|WITH|ZER|ZONEWIDTH)(?:\$|\b)/i,operator:/<[=>]?|>=?|[+\-*\/^=&]|\b(?:AND|EQV|IMP|NOT|OR|XOR)\b/,punctuation:/[,;:()]/}; \ No newline at end of file diff --git a/examples/prism-basic.html b/examples/prism-basic.html new file mode 100644 index 0000000000..434f9ef189 --- /dev/null +++ b/examples/prism-basic.html @@ -0,0 +1,83 @@ +

BASIC

+

To use this language, use the class "language-basic".

+ +

Note: this component focuses on first and second-generation BASICs (such as MSX BASIC, GW-BASIC, SuperBASIC, QuickBASIC, PowerBASIC...).

+ +

Comments

+
! This is a comment
+REM This is a remark
+ +

Strings

+
"This a string."
+"This is a string with ""quotes"" in it."
+ +

Numbers

+
42
+3.14159
+-42
+-3.14159
+.5
+10.
+2E10
+4.2E-14
+-3E+2
+ +

Dartmouth Basic example

+
5 LET S = 0
+10 MAT INPUT V
+20 LET N = NUM
+30 IF N = 0 THEN 99
+40 FOR I = 1 TO N
+45 LET S = S + V(I)
+50 NEXT I
+60 PRINT S/N
+70 GO TO 5
+99 END
+ +

GW-BASIC example

+
10 INPUT "What is your name: ", U$
+20 PRINT "Hello "; U$
+30 INPUT "How many stars do you want: ", N
+40 S$ = ""
+50 FOR I = 1 TO N
+60 S$ = S$ + "*"
+70 NEXT I
+80 PRINT S$
+90 INPUT "Do you want more stars? ", A$
+100 IF LEN(A$) = 0 THEN GOTO 90
+110 A$ = LEFT$(A$, 1)
+120 IF A$ = "Y" OR A$ = "y" THEN GOTO 30
+130 PRINT "Goodbye "; U$
+140 END
+ +

QuickBASIC example

+
DECLARE SUB PrintSomeStars (StarCount!)
+REM QuickBASIC example
+INPUT "What is your name: ", UserName$
+PRINT "Hello "; UserName$
+DO
+   INPUT "How many stars do you want: ", NumStars
+   CALL PrintSomeStars(NumStars)
+   DO
+      INPUT "Do you want more stars? ", Answer$
+   LOOP UNTIL Answer$ <> ""
+   Answer$ = LEFT$(Answer$, 1)
+LOOP WHILE UCASE$(Answer$) = "Y"
+PRINT "Goodbye "; UserName$
+
+SUB PrintSomeStars (StarCount)
+   REM This procedure uses a local variable called Stars$
+   Stars$ = STRING$(StarCount, "*")
+   PRINT Stars$
+END SUB
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Two double quotes inside a comment

+
! This "comment" is broken
+REM This "remark" is broken
\ No newline at end of file diff --git a/plugins/show-language/prism-show-language.js b/plugins/show-language/prism-show-language.js index 8ee5d80beb..f48fad548a 100644 --- a/plugins/show-language/prism-show-language.js +++ b/plugins/show-language/prism-show-language.js @@ -5,7 +5,7 @@ if (typeof self === 'undefined' || !self.Prism || !self.document) { } // The languages map is built automatically with gulp -var Languages = /*languages_placeholder[*/{"css":"CSS","clike":"C-like","javascript":"JavaScript","actionscript":"ActionScript","apacheconf":"Apache Configuration","apl":"APL","applescript":"AppleScript","aspnet":"ASP.NET (C#)","autohotkey":"AutoHotkey","csharp":"C#","cpp":"C++","coffeescript":"CoffeeScript","css-extras":"CSS Extras","fsharp":"F#","glsl":"GLSL","http":"HTTP","inform7":"Inform 7","latex":"LaTeX","lolcode":"LOLCODE","matlab":"MATLAB","mel":"MEL","nasm":"NASM","nsis":"NSIS","objectivec":"Objective-C","php":"PHP","php-extras":"PHP Extras","powershell":"PowerShell","jsx":"React JSX","rest":"reST (reStructuredText)","sas":"SAS","sass":"Sass (Sass)","scss":"Sass (Scss)","sql":"SQL","typescript":"TypeScript","vhdl":"VHDL","wiki":"Wiki markup","yaml":"YAML"}/*]*/; +var Languages = /*languages_placeholder[*/{"css":"CSS","clike":"C-like","javascript":"JavaScript","actionscript":"ActionScript","apacheconf":"Apache Configuration","apl":"APL","applescript":"AppleScript","aspnet":"ASP.NET (C#)","autohotkey":"AutoHotkey","basic":"BASIC","csharp":"C#","cpp":"C++","coffeescript":"CoffeeScript","css-extras":"CSS Extras","fsharp":"F#","glsl":"GLSL","http":"HTTP","inform7":"Inform 7","latex":"LaTeX","lolcode":"LOLCODE","matlab":"MATLAB","mel":"MEL","nasm":"NASM","nsis":"NSIS","objectivec":"Objective-C","php":"PHP","php-extras":"PHP Extras","powershell":"PowerShell","jsx":"React JSX","rest":"reST (reStructuredText)","sas":"SAS","sass":"Sass (Sass)","scss":"Sass (Scss)","sql":"SQL","typescript":"TypeScript","vhdl":"VHDL","wiki":"Wiki markup","yaml":"YAML"}/*]*/; Prism.hooks.add('before-highlight', function(env) { var pre = env.element.parentNode; if (!pre || !/pre/i.test(pre.nodeName)) { diff --git a/plugins/show-language/prism-show-language.min.js b/plugins/show-language/prism-show-language.min.js index 7684cfdc42..67d1bf4da6 100644 --- a/plugins/show-language/prism-show-language.min.js +++ b/plugins/show-language/prism-show-language.min.js @@ -1 +1 @@ -!function(){if("undefined"!=typeof self&&self.Prism&&self.document){var e={css:"CSS",clike:"C-like",javascript:"JavaScript",actionscript:"ActionScript",apacheconf:"Apache Configuration",apl:"APL",applescript:"AppleScript",aspnet:"ASP.NET (C#)",autohotkey:"AutoHotkey",csharp:"C#",cpp:"C++",coffeescript:"CoffeeScript","css-extras":"CSS Extras",fsharp:"F#",glsl:"GLSL",http:"HTTP",inform7:"Inform 7",latex:"LaTeX",lolcode:"LOLCODE",matlab:"MATLAB",mel:"MEL",nasm:"NASM",nsis:"NSIS",objectivec:"Objective-C",php:"PHP","php-extras":"PHP Extras",powershell:"PowerShell",jsx:"React JSX",rest:"reST (reStructuredText)",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)",sql:"SQL",typescript:"TypeScript",vhdl:"VHDL",wiki:"Wiki markup",yaml:"YAML"};Prism.hooks.add("before-highlight",function(s){var t=s.element.parentNode;if(t&&/pre/i.test(t.nodeName)){var a=e[s.language]||s.language.substring(0,1).toUpperCase()+s.language.substring(1);t.setAttribute("data-language",a)}})}}(); \ No newline at end of file +!function(){if("undefined"!=typeof self&&self.Prism&&self.document){var e={css:"CSS",clike:"C-like",javascript:"JavaScript",actionscript:"ActionScript",apacheconf:"Apache Configuration",apl:"APL",applescript:"AppleScript",aspnet:"ASP.NET (C#)",autohotkey:"AutoHotkey",basic:"BASIC",csharp:"C#",cpp:"C++",coffeescript:"CoffeeScript","css-extras":"CSS Extras",fsharp:"F#",glsl:"GLSL",http:"HTTP",inform7:"Inform 7",latex:"LaTeX",lolcode:"LOLCODE",matlab:"MATLAB",mel:"MEL",nasm:"NASM",nsis:"NSIS",objectivec:"Objective-C",php:"PHP","php-extras":"PHP Extras",powershell:"PowerShell",jsx:"React JSX",rest:"reST (reStructuredText)",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)",sql:"SQL",typescript:"TypeScript",vhdl:"VHDL",wiki:"Wiki markup",yaml:"YAML"};Prism.hooks.add("before-highlight",function(s){var t=s.element.parentNode;if(t&&/pre/i.test(t.nodeName)){var a=e[s.language]||s.language.substring(0,1).toUpperCase()+s.language.substring(1);t.setAttribute("data-language",a)}})}}(); \ No newline at end of file diff --git a/tests/languages/basic/comment_feature.test b/tests/languages/basic/comment_feature.test new file mode 100644 index 0000000000..d306176161 --- /dev/null +++ b/tests/languages/basic/comment_feature.test @@ -0,0 +1,13 @@ +! Foobar +REM Foobar + +---------------------------------------------------- + +[ + ["comment", ["! Foobar"]], + ["comment", [["keyword", "REM"], " Foobar"]] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/tests/languages/basic/function_feature.test b/tests/languages/basic/function_feature.test new file mode 100644 index 0000000000..5fe8d760e3 --- /dev/null +++ b/tests/languages/basic/function_feature.test @@ -0,0 +1,309 @@ +ABS +ACCESS +ACOS +ANGLE +AREA +ARITHMETIC +ARRAY +ASIN +ASK +AT +ATN +BASE +BEGIN +BREAK +CAUSE +CEIL +CHR +CLIP +COLLATE +COLOR +CON +COS +COSH +COT +CSC +DATE +DATUM +DEBUG +DECIMAL +DEF +DEG +DEGREES +DELETE +DET +DEVICE +DISPLAY +DOT +ELAPSED +EPS +ERASABLE +EXLINE +EXP +EXTERNAL +EXTYPE +FILETYPE +FIXED +FP +GO +GRAPH +HANDLER +IDN +IMAGE +IN +INT +INTERNAL +IP +IS +KEYED +LBOUND +LCASE +LEFT +LEN +LENGTH +LET +LINE +LINES +LOG +LOG10 +LOG2 +LTRIM +MARGIN +MAT +MAX +MAXNUM +MID +MIN +MISSING +MOD +NATIVE +NUL +NUMERIC +OF +OPTION +ORD +ORGANIZATION +OUTIN +OUTPUT +PI +POINT +POINTER +POINTS +POS +PRINT +PROGRAM +PROMPT +RAD +RADIANS +RANDOMIZE +RECORD +RECSIZE +RECTYPE +RELATIVE +REMAINDER +REPEAT +REST +RETRY +REWRITE +RIGHT +RND +ROUND +RTRIM +SAME +SEC +SELECT +SEQUENTIAL +SET +SETTER +SGN +SIN +SINH +SIZE +SKIP +SQR +STANDARD +STATUS +STR +STREAM +STYLE +TAB +TAN +TANH +TEMPLATE +TEXT +THERE +TIME +TIMEOUT +TRACE +TRANSFORM +TRUNCATE +UBOUND +UCASE +USE +VAL +VARIABLE +VIEWPORT +WHEN +WINDOW +WITH +ZER +ZONEWIDTH + +---------------------------------------------------- + +[ + ["function", "ABS"], + ["function", "ACCESS"], + ["function", "ACOS"], + ["function", "ANGLE"], + ["function", "AREA"], + ["function", "ARITHMETIC"], + ["function", "ARRAY"], + ["function", "ASIN"], + ["function", "ASK"], + ["function", "AT"], + ["function", "ATN"], + ["function", "BASE"], + ["function", "BEGIN"], + ["function", "BREAK"], + ["function", "CAUSE"], + ["function", "CEIL"], + ["function", "CHR"], + ["function", "CLIP"], + ["function", "COLLATE"], + ["function", "COLOR"], + ["function", "CON"], + ["function", "COS"], + ["function", "COSH"], + ["function", "COT"], + ["function", "CSC"], + ["function", "DATE"], + ["function", "DATUM"], + ["function", "DEBUG"], + ["function", "DECIMAL"], + ["function", "DEF"], + ["function", "DEG"], + ["function", "DEGREES"], + ["function", "DELETE"], + ["function", "DET"], + ["function", "DEVICE"], + ["function", "DISPLAY"], + ["function", "DOT"], + ["function", "ELAPSED"], + ["function", "EPS"], + ["function", "ERASABLE"], + ["function", "EXLINE"], + ["function", "EXP"], + ["function", "EXTERNAL"], + ["function", "EXTYPE"], + ["function", "FILETYPE"], + ["function", "FIXED"], + ["function", "FP"], + ["function", "GO"], + ["function", "GRAPH"], + ["function", "HANDLER"], + ["function", "IDN"], + ["function", "IMAGE"], + ["function", "IN"], + ["function", "INT"], + ["function", "INTERNAL"], + ["function", "IP"], + ["function", "IS"], + ["function", "KEYED"], + ["function", "LBOUND"], + ["function", "LCASE"], + ["function", "LEFT"], + ["function", "LEN"], + ["function", "LENGTH"], + ["function", "LET"], + ["function", "LINE"], + ["function", "LINES"], + ["function", "LOG"], + ["function", "LOG10"], + ["function", "LOG2"], + ["function", "LTRIM"], + ["function", "MARGIN"], + ["function", "MAT"], + ["function", "MAX"], + ["function", "MAXNUM"], + ["function", "MID"], + ["function", "MIN"], + ["function", "MISSING"], + ["function", "MOD"], + ["function", "NATIVE"], + ["function", "NUL"], + ["function", "NUMERIC"], + ["function", "OF"], + ["function", "OPTION"], + ["function", "ORD"], + ["function", "ORGANIZATION"], + ["function", "OUTIN"], + ["function", "OUTPUT"], + ["function", "PI"], + ["function", "POINT"], + ["function", "POINTER"], + ["function", "POINTS"], + ["function", "POS"], + ["function", "PRINT"], + ["function", "PROGRAM"], + ["function", "PROMPT"], + ["function", "RAD"], + ["function", "RADIANS"], + ["function", "RANDOMIZE"], + ["function", "RECORD"], + ["function", "RECSIZE"], + ["function", "RECTYPE"], + ["function", "RELATIVE"], + ["function", "REMAINDER"], + ["function", "REPEAT"], + ["function", "REST"], + ["function", "RETRY"], + ["function", "REWRITE"], + ["function", "RIGHT"], + ["function", "RND"], + ["function", "ROUND"], + ["function", "RTRIM"], + ["function", "SAME"], + ["function", "SEC"], + ["function", "SELECT"], + ["function", "SEQUENTIAL"], + ["function", "SET"], + ["function", "SETTER"], + ["function", "SGN"], + ["function", "SIN"], + ["function", "SINH"], + ["function", "SIZE"], + ["function", "SKIP"], + ["function", "SQR"], + ["function", "STANDARD"], + ["function", "STATUS"], + ["function", "STR"], + ["function", "STREAM"], + ["function", "STYLE"], + ["function", "TAB"], + ["function", "TAN"], + ["function", "TANH"], + ["function", "TEMPLATE"], + ["function", "TEXT"], + ["function", "THERE"], + ["function", "TIME"], + ["function", "TIMEOUT"], + ["function", "TRACE"], + ["function", "TRANSFORM"], + ["function", "TRUNCATE"], + ["function", "UBOUND"], + ["function", "UCASE"], + ["function", "USE"], + ["function", "VAL"], + ["function", "VARIABLE"], + ["function", "VIEWPORT"], + ["function", "WHEN"], + ["function", "WINDOW"], + ["function", "WITH"], + ["function", "ZER"], + ["function", "ZONEWIDTH"] +] + +---------------------------------------------------- + +Checks for functions. \ No newline at end of file diff --git a/tests/languages/basic/keyword_feature.test b/tests/languages/basic/keyword_feature.test new file mode 100644 index 0000000000..ecac6855ed --- /dev/null +++ b/tests/languages/basic/keyword_feature.test @@ -0,0 +1,213 @@ +AS +BEEP +BLOAD +BSAVE +CALL +CALL ABSOLUTE +CASE +CHAIN +CHDIR +CLEAR +CLOSE +CLS +COM +COMMON +CONST +DATA +DECLARE +DEF FN +DEF SEG +DEFDBL +DEFINT +DEFLNG +DEFSNG +DEFSTR +DIM +DO +DOUBLE +ELSE +ELSEIF +END +ENVIRON +ERASE +ERROR +EXIT +FIELD +FILES +FOR +FUNCTION +GET +GOSUB +GOTO +IF +INPUT +INTEGER +IOCTL +KEY +KILL +LINE INPUT +LOCATE +LOCK +LONG +LOOP +LSET +MKDIR +NAME +NEXT +OFF +ON +ON COM +ON ERROR +ON KEY +ON TIMER +OPEN +OPTION BASE +OUT +POKE +PUT +READ +REDIM +REM +RESTORE +RESUME +RETURN +RMDIR +RSET +RUN +SHARED +SINGLE +SELECT CASE +SHELL +SLEEP +STATIC +STEP +STOP +STRING +SUB +SWAP +SYSTEM +THEN +TIMER +TO +TROFF +TRON +TYPE +UNLOCK +UNTIL +USING +VIEW PRINT +WAIT +WEND +WHILE +WRITE + +---------------------------------------------------- + +[ + ["keyword", "AS"], + ["keyword", "BEEP"], + ["keyword", "BLOAD"], + ["keyword", "BSAVE"], + ["keyword", "CALL"], + ["keyword", "CALL ABSOLUTE"], + ["keyword", "CASE"], + ["keyword", "CHAIN"], + ["keyword", "CHDIR"], + ["keyword", "CLEAR"], + ["keyword", "CLOSE"], + ["keyword", "CLS"], + ["keyword", "COM"], + ["keyword", "COMMON"], + ["keyword", "CONST"], + ["keyword", "DATA"], + ["keyword", "DECLARE"], + ["keyword", "DEF FN"], + ["keyword", "DEF SEG"], + ["keyword", "DEFDBL"], + ["keyword", "DEFINT"], + ["keyword", "DEFLNG"], + ["keyword", "DEFSNG"], + ["keyword", "DEFSTR"], + ["keyword", "DIM"], + ["keyword", "DO"], + ["keyword", "DOUBLE"], + ["keyword", "ELSE"], + ["keyword", "ELSEIF"], + ["keyword", "END"], + ["keyword", "ENVIRON"], + ["keyword", "ERASE"], + ["keyword", "ERROR"], + ["keyword", "EXIT"], + ["keyword", "FIELD"], + ["keyword", "FILES"], + ["keyword", "FOR"], + ["keyword", "FUNCTION"], + ["keyword", "GET"], + ["keyword", "GOSUB"], + ["keyword", "GOTO"], + ["keyword", "IF"], + ["keyword", "INPUT"], + ["keyword", "INTEGER"], + ["keyword", "IOCTL"], + ["keyword", "KEY"], + ["keyword", "KILL"], + ["keyword", "LINE INPUT"], + ["keyword", "LOCATE"], + ["keyword", "LOCK"], + ["keyword", "LONG"], + ["keyword", "LOOP"], + ["keyword", "LSET"], + ["keyword", "MKDIR"], + ["keyword", "NAME"], + ["keyword", "NEXT"], + ["keyword", "OFF"], + ["keyword", "ON"], + ["keyword", "ON COM"], + ["keyword", "ON ERROR"], + ["keyword", "ON KEY"], + ["keyword", "ON TIMER"], + ["keyword", "OPEN"], + ["keyword", "OPTION BASE"], + ["keyword", "OUT"], + ["keyword", "POKE"], + ["keyword", "PUT"], + ["keyword", "READ"], + ["keyword", "REDIM"], + ["keyword", "REM"], + ["keyword", "RESTORE"], + ["keyword", "RESUME"], + ["keyword", "RETURN"], + ["keyword", "RMDIR"], + ["keyword", "RSET"], + ["keyword", "RUN"], + ["keyword", "SHARED"], + ["keyword", "SINGLE"], + ["keyword", "SELECT CASE"], + ["keyword", "SHELL"], + ["keyword", "SLEEP"], + ["keyword", "STATIC"], + ["keyword", "STEP"], + ["keyword", "STOP"], + ["keyword", "STRING"], + ["keyword", "SUB"], + ["keyword", "SWAP"], + ["keyword", "SYSTEM"], + ["keyword", "THEN"], + ["keyword", "TIMER"], + ["keyword", "TO"], + ["keyword", "TROFF"], + ["keyword", "TRON"], + ["keyword", "TYPE"], + ["keyword", "UNLOCK"], + ["keyword", "UNTIL"], + ["keyword", "USING"], + ["keyword", "VIEW PRINT"], + ["keyword", "WAIT"], + ["keyword", "WEND"], + ["keyword", "WHILE"], + ["keyword", "WRITE"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/tests/languages/basic/number_feature.test b/tests/languages/basic/number_feature.test new file mode 100644 index 0000000000..5adeb7af0a --- /dev/null +++ b/tests/languages/basic/number_feature.test @@ -0,0 +1,19 @@ +42 +3.14159 +2e8 +3.4E-9 +0.7E+12 + +---------------------------------------------------- + +[ + ["number", "42"], + ["number", "3.14159"], + ["number", "2e8"], + ["number", "3.4E-9"], + ["number", "0.7E+12"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/tests/languages/basic/operator_feature.test b/tests/languages/basic/operator_feature.test new file mode 100644 index 0000000000..b2d93f619b --- /dev/null +++ b/tests/languages/basic/operator_feature.test @@ -0,0 +1,21 @@ +< <= <> +> >= ++ - * / +^ = & +AND EQV IMP +NOT OR XOR + +---------------------------------------------------- + +[ + ["operator", "<"], ["operator", "<="], ["operator", "<>"], + ["operator", ">"], ["operator", ">="], + ["operator", "+"], ["operator", "-"], ["operator", "*"], ["operator", "/"], + ["operator", "^"], ["operator", "="], ["operator", "&"], + ["operator", "AND"], ["operator", "EQV"], ["operator", "IMP"], + ["operator", "NOT"], ["operator", "OR"], ["operator", "XOR"] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/tests/languages/basic/string_feature.test b/tests/languages/basic/string_feature.test new file mode 100644 index 0000000000..83fea35edb --- /dev/null +++ b/tests/languages/basic/string_feature.test @@ -0,0 +1,13 @@ +"" +"fo""obar" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"fo\"\"obar\""] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file