Added support for GAP (CAS) (#3054)
This commit is contained in:
parent
8d0b74b521
commit
23cd9b655b
File diff suppressed because one or more lines are too long
|
@ -446,6 +446,10 @@
|
|||
"require": "clike",
|
||||
"owner": "LiarOnce"
|
||||
},
|
||||
"gap": {
|
||||
"title": "GAP (CAS)",
|
||||
"owner": "RunDevelopment"
|
||||
},
|
||||
"gcode": {
|
||||
"title": "G-code",
|
||||
"owner": "RunDevelopment"
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
// https://www.gap-system.org/Manuals/doc/ref/chap4.html
|
||||
// https://www.gap-system.org/Manuals/doc/ref/chap27.html
|
||||
|
||||
Prism.languages.gap = {
|
||||
'shell': {
|
||||
pattern: /^gap>[\s\S]*?(?=^gap>|$(?![\s\S]))/m,
|
||||
greedy: true,
|
||||
inside: {
|
||||
'gap': {
|
||||
pattern: /^(gap>).+(?:(?:\r(?:\n|(?!\n))|\n)>.*)*/,
|
||||
lookbehind: true,
|
||||
inside: null // see below
|
||||
},
|
||||
'punctuation': /^gap>/
|
||||
}
|
||||
},
|
||||
|
||||
'comment': {
|
||||
pattern: /#.*/,
|
||||
greedy: true
|
||||
},
|
||||
'string': {
|
||||
pattern: /(^|[^\\'"])(?:'(?:[^\r\n\\']|\\.){1,10}'|"(?:[^\r\n\\"]|\\.)*"(?!")|"""[\s\S]*?""")/,
|
||||
lookbehind: true,
|
||||
greedy: true,
|
||||
inside: {
|
||||
'continuation': {
|
||||
pattern: /([\r\n])>/,
|
||||
lookbehind: true,
|
||||
alias: 'punctuation'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
'keyword': /\b(?:Assert|Info|IsBound|QUIT|TryNextMethod|Unbind|and|atomic|break|continue|do|elif|else|end|fi|for|function|if|in|local|mod|not|od|or|quit|readonly|readwrite|rec|repeat|return|then|until|while)\b/,
|
||||
'boolean': /\b(?:false|true)\b/,
|
||||
|
||||
'function': /\b[a-z_]\w*(?=\s*\()/i,
|
||||
|
||||
'number': {
|
||||
pattern: /(^|[^\w.]|\.\.)(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?(?:_[a-z]?)?(?=$|[^\w.]|\.\.)/,
|
||||
lookbehind: true
|
||||
},
|
||||
|
||||
'continuation': {
|
||||
pattern: /([\r\n])>/,
|
||||
lookbehind: true,
|
||||
alias: 'punctuation'
|
||||
},
|
||||
'operator': /->|[-+*/^~=!]|<>|[<>]=?|:=|\.\./,
|
||||
'punctuation': /[()[\]{},;.:]/
|
||||
};
|
||||
|
||||
Prism.languages.gap.shell.inside.gap.inside = Prism.languages.gap;
|
|
@ -0,0 +1 @@
|
|||
Prism.languages.gap={shell:{pattern:/^gap>[\s\S]*?(?=^gap>|$(?![\s\S]))/m,greedy:!0,inside:{gap:{pattern:/^(gap>).+(?:(?:\r(?:\n|(?!\n))|\n)>.*)*/,lookbehind:!0,inside:null},punctuation:/^gap>/}},comment:{pattern:/#.*/,greedy:!0},string:{pattern:/(^|[^\\'"])(?:'(?:[^\r\n\\']|\\.){1,10}'|"(?:[^\r\n\\"]|\\.)*"(?!")|"""[\s\S]*?""")/,lookbehind:!0,greedy:!0,inside:{continuation:{pattern:/([\r\n])>/,lookbehind:!0,alias:"punctuation"}}},keyword:/\b(?:Assert|Info|IsBound|QUIT|TryNextMethod|Unbind|and|atomic|break|continue|do|elif|else|end|fi|for|function|if|in|local|mod|not|od|or|quit|readonly|readwrite|rec|repeat|return|then|until|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:{pattern:/(^|[^\w.]|\.\.)(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?(?:_[a-z]?)?(?=$|[^\w.]|\.\.)/,lookbehind:!0},continuation:{pattern:/([\r\n])>/,lookbehind:!0,alias:"punctuation"},operator:/->|[-+*/^~=!]|<>|[<>]=?|:=|\.\./,punctuation:/[()[\]{},;.:]/},Prism.languages.gap.shell.inside.gap.inside=Prism.languages.gap;
|
|
@ -0,0 +1,15 @@
|
|||
<h2>Full example</h2>
|
||||
<pre><code># Source: https://www.gap-system.org/Manuals/doc/ref/chap4.html#X815F71EA7BC0EB6F
|
||||
gap> fib := function ( n )
|
||||
> local f1, f2, f3, i;
|
||||
> f1 := 1; f2 := 1;
|
||||
> for i in [3..n] do
|
||||
> f3 := f1 + f2;
|
||||
> f1 := f2;
|
||||
> f2 := f3;
|
||||
> od;
|
||||
> return f2;
|
||||
> end;;
|
||||
gap> List( [1..10], fib );
|
||||
[ 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 ]
|
||||
</code></pre>
|
|
@ -87,6 +87,7 @@
|
|||
"ftl": "FreeMarker Template Language",
|
||||
"gml": "GameMaker Language",
|
||||
"gamemakerlanguage": "GameMaker Language",
|
||||
"gap": "GAP (CAS)",
|
||||
"gcode": "G-code",
|
||||
"gdscript": "GDScript",
|
||||
"gedcom": "GEDCOM",
|
||||
|
|
|
@ -1 +1 @@
|
|||
!function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document)if(Prism.plugins.toolbar){var i={none:"Plain text",plain:"Plain text",plaintext:"Plain text",text:"Plain text",txt:"Plain text",html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",ssml:"SSML",rss:"RSS",css:"CSS",clike:"C-like",js:"JavaScript",abap:"ABAP",abnf:"ABNF",al:"AL",antlr4:"ANTLR4",g4:"ANTLR4",apacheconf:"Apache Configuration",apl:"APL",aql:"AQL",arff:"ARFF",asciidoc:"AsciiDoc",adoc:"AsciiDoc",aspnet:"ASP.NET (C#)",asm6502:"6502 Assembly",autohotkey:"AutoHotkey",autoit:"AutoIt","avro-idl":"Avro IDL",avdl:"Avro IDL",basic:"BASIC",bbcode:"BBcode",bnf:"BNF",rbnf:"RBNF",bsl:"BSL (1C:Enterprise)",oscript:"OneScript",csharp:"C#",cs:"C#",dotnet:"C#",cpp:"C++",cfscript:"CFScript",cfc:"CFScript",cil:"CIL",cmake:"CMake",cobol:"COBOL",coffee:"CoffeeScript",conc:"Concurnas",csp:"Content-Security-Policy","css-extras":"CSS Extras",csv:"CSV",dataweave:"DataWeave",dax:"DAX",django:"Django/Jinja2",jinja2:"Django/Jinja2","dns-zone-file":"DNS zone file","dns-zone":"DNS zone file",dockerfile:"Docker",dot:"DOT (Graphviz)",gv:"DOT (Graphviz)",ebnf:"EBNF",editorconfig:"EditorConfig",ejs:"EJS",etlua:"Embedded Lua templating",erb:"ERB","excel-formula":"Excel Formula",xlsx:"Excel Formula",xls:"Excel Formula",fsharp:"F#","firestore-security-rules":"Firestore security rules",ftl:"FreeMarker Template Language",gml:"GameMaker Language",gamemakerlanguage:"GameMaker Language",gcode:"G-code",gdscript:"GDScript",gedcom:"GEDCOM",glsl:"GLSL",gn:"GN",gni:"GN",graphql:"GraphQL",hbs:"Handlebars",hs:"Haskell",hcl:"HCL",hlsl:"HLSL",http:"HTTP",hpkp:"HTTP Public-Key-Pins",hsts:"HTTP Strict-Transport-Security",ichigojam:"IchigoJam","icu-message-format":"ICU Message Format",idr:"Idris",ignore:".ignore",gitignore:".gitignore",hgignore:".hgignore",npmignore:".npmignore",inform7:"Inform 7",javadoc:"JavaDoc",javadoclike:"JavaDoc-like",javastacktrace:"Java stack trace",jq:"JQ",jsdoc:"JSDoc","js-extras":"JS Extras",json:"JSON",webmanifest:"Web App Manifest",json5:"JSON5",jsonp:"JSONP",jsstacktrace:"JS stack trace","js-templates":"JS Templates",kts:"Kotlin Script",kt:"Kotlin",kumir:"KuMir (КуМир)",kum:"KuMir (КуМир)",latex:"LaTeX",tex:"TeX",context:"ConTeXt",lilypond:"LilyPond",ly:"LilyPond",emacs:"Lisp",elisp:"Lisp","emacs-lisp":"Lisp",llvm:"LLVM IR",log:"Log file",lolcode:"LOLCODE",md:"Markdown","markup-templating":"Markup templating",matlab:"MATLAB",mel:"MEL",mongodb:"MongoDB",moon:"MoonScript",n1ql:"N1QL",n4js:"N4JS",n4jsd:"N4JS","nand2tetris-hdl":"Nand To Tetris HDL",naniscript:"Naninovel Script",nani:"Naninovel Script",nasm:"NASM",neon:"NEON",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",objc:"Objective-C",ocaml:"OCaml",opencl:"OpenCL",openqasm:"OpenQasm",qasm:"OpenQasm",parigp:"PARI/GP",objectpascal:"Object Pascal",psl:"PATROL Scripting Language",pcaxis:"PC-Axis",px:"PC-Axis",peoplecode:"PeopleCode",pcode:"PeopleCode",php:"PHP",phpdoc:"PHPDoc","php-extras":"PHP Extras",plsql:"PL/SQL",powerquery:"PowerQuery",pq:"PowerQuery",mscript:"PowerQuery",powershell:"PowerShell",promql:"PromQL",properties:".properties",protobuf:"Protocol Buffers",purebasic:"PureBasic",pbfasm:"PureBasic",purs:"PureScript",py:"Python",qsharp:"Q#",qs:"Q#",q:"Q (kdb+ database)",qml:"QML",rkt:"Racket",jsx:"React JSX",tsx:"React TSX",renpy:"Ren'py",rpy:"Ren'py",rest:"reST (reStructuredText)",robotframework:"Robot Framework",robot:"Robot Framework",rb:"Ruby",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)","shell-session":"Shell session","sh-session":"Shell session",shellsession:"Shell session",sml:"SML",smlnj:"SML/NJ",solidity:"Solidity (Ethereum)",sol:"Solidity (Ethereum)","solution-file":"Solution file",sln:"Solution file",soy:"Soy (Closure Template)",sparql:"SPARQL",rq:"SPARQL","splunk-spl":"Splunk SPL",sqf:"SQF: Status Quo Function (Arma 3)",sql:"SQL",iecst:"Structured Text (IEC 61131-3)",systemd:"Systemd configuration file","t4-templating":"T4 templating","t4-cs":"T4 Text Templates (C#)",t4:"T4 Text Templates (C#)","t4-vb":"T4 Text Templates (VB)",tap:"TAP",tt2:"Template Toolkit 2",toml:"TOML",trig:"TriG",ts:"TypeScript",tsconfig:"TSConfig",uscript:"UnrealScript",uc:"UnrealScript",uri:"URI",url:"URL",vbnet:"VB.Net",vhdl:"VHDL",vim:"vim","visual-basic":"Visual Basic",vba:"VBA",vb:"Visual Basic",wasm:"WebAssembly",wiki:"Wiki markup",wolfram:"Wolfram language",nb:"Mathematica Notebook",wl:"Wolfram language",xeoracube:"XeoraCube","xml-doc":"XML doc (.net)",xojo:"Xojo (REALbasic)",xquery:"XQuery",yaml:"YAML",yml:"YAML",yang:"YANG"};Prism.plugins.toolbar.registerButton("show-language",function(e){var a=e.element.parentNode;if(a&&/pre/i.test(a.nodeName)){var t,s=a.getAttribute("data-language")||i[e.language]||((t=e.language)?(t.substring(0,1).toUpperCase()+t.substring(1)).replace(/s(?=cript)/,"S"):t);if(s){var o=document.createElement("span");return o.textContent=s,o}}})}else console.warn("Show Languages plugin loaded before Toolbar plugin.")}();
|
||||
!function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document)if(Prism.plugins.toolbar){var i={none:"Plain text",plain:"Plain text",plaintext:"Plain text",text:"Plain text",txt:"Plain text",html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",ssml:"SSML",rss:"RSS",css:"CSS",clike:"C-like",js:"JavaScript",abap:"ABAP",abnf:"ABNF",al:"AL",antlr4:"ANTLR4",g4:"ANTLR4",apacheconf:"Apache Configuration",apl:"APL",aql:"AQL",arff:"ARFF",asciidoc:"AsciiDoc",adoc:"AsciiDoc",aspnet:"ASP.NET (C#)",asm6502:"6502 Assembly",autohotkey:"AutoHotkey",autoit:"AutoIt","avro-idl":"Avro IDL",avdl:"Avro IDL",basic:"BASIC",bbcode:"BBcode",bnf:"BNF",rbnf:"RBNF",bsl:"BSL (1C:Enterprise)",oscript:"OneScript",csharp:"C#",cs:"C#",dotnet:"C#",cpp:"C++",cfscript:"CFScript",cfc:"CFScript",cil:"CIL",cmake:"CMake",cobol:"COBOL",coffee:"CoffeeScript",conc:"Concurnas",csp:"Content-Security-Policy","css-extras":"CSS Extras",csv:"CSV",dataweave:"DataWeave",dax:"DAX",django:"Django/Jinja2",jinja2:"Django/Jinja2","dns-zone-file":"DNS zone file","dns-zone":"DNS zone file",dockerfile:"Docker",dot:"DOT (Graphviz)",gv:"DOT (Graphviz)",ebnf:"EBNF",editorconfig:"EditorConfig",ejs:"EJS",etlua:"Embedded Lua templating",erb:"ERB","excel-formula":"Excel Formula",xlsx:"Excel Formula",xls:"Excel Formula",fsharp:"F#","firestore-security-rules":"Firestore security rules",ftl:"FreeMarker Template Language",gml:"GameMaker Language",gamemakerlanguage:"GameMaker Language",gap:"GAP (CAS)",gcode:"G-code",gdscript:"GDScript",gedcom:"GEDCOM",glsl:"GLSL",gn:"GN",gni:"GN",graphql:"GraphQL",hbs:"Handlebars",hs:"Haskell",hcl:"HCL",hlsl:"HLSL",http:"HTTP",hpkp:"HTTP Public-Key-Pins",hsts:"HTTP Strict-Transport-Security",ichigojam:"IchigoJam","icu-message-format":"ICU Message Format",idr:"Idris",ignore:".ignore",gitignore:".gitignore",hgignore:".hgignore",npmignore:".npmignore",inform7:"Inform 7",javadoc:"JavaDoc",javadoclike:"JavaDoc-like",javastacktrace:"Java stack trace",jq:"JQ",jsdoc:"JSDoc","js-extras":"JS Extras",json:"JSON",webmanifest:"Web App Manifest",json5:"JSON5",jsonp:"JSONP",jsstacktrace:"JS stack trace","js-templates":"JS Templates",kts:"Kotlin Script",kt:"Kotlin",kumir:"KuMir (КуМир)",kum:"KuMir (КуМир)",latex:"LaTeX",tex:"TeX",context:"ConTeXt",lilypond:"LilyPond",ly:"LilyPond",emacs:"Lisp",elisp:"Lisp","emacs-lisp":"Lisp",llvm:"LLVM IR",log:"Log file",lolcode:"LOLCODE",md:"Markdown","markup-templating":"Markup templating",matlab:"MATLAB",mel:"MEL",mongodb:"MongoDB",moon:"MoonScript",n1ql:"N1QL",n4js:"N4JS",n4jsd:"N4JS","nand2tetris-hdl":"Nand To Tetris HDL",naniscript:"Naninovel Script",nani:"Naninovel Script",nasm:"NASM",neon:"NEON",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",objc:"Objective-C",ocaml:"OCaml",opencl:"OpenCL",openqasm:"OpenQasm",qasm:"OpenQasm",parigp:"PARI/GP",objectpascal:"Object Pascal",psl:"PATROL Scripting Language",pcaxis:"PC-Axis",px:"PC-Axis",peoplecode:"PeopleCode",pcode:"PeopleCode",php:"PHP",phpdoc:"PHPDoc","php-extras":"PHP Extras",plsql:"PL/SQL",powerquery:"PowerQuery",pq:"PowerQuery",mscript:"PowerQuery",powershell:"PowerShell",promql:"PromQL",properties:".properties",protobuf:"Protocol Buffers",purebasic:"PureBasic",pbfasm:"PureBasic",purs:"PureScript",py:"Python",qsharp:"Q#",qs:"Q#",q:"Q (kdb+ database)",qml:"QML",rkt:"Racket",jsx:"React JSX",tsx:"React TSX",renpy:"Ren'py",rpy:"Ren'py",rest:"reST (reStructuredText)",robotframework:"Robot Framework",robot:"Robot Framework",rb:"Ruby",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)","shell-session":"Shell session","sh-session":"Shell session",shellsession:"Shell session",sml:"SML",smlnj:"SML/NJ",solidity:"Solidity (Ethereum)",sol:"Solidity (Ethereum)","solution-file":"Solution file",sln:"Solution file",soy:"Soy (Closure Template)",sparql:"SPARQL",rq:"SPARQL","splunk-spl":"Splunk SPL",sqf:"SQF: Status Quo Function (Arma 3)",sql:"SQL",iecst:"Structured Text (IEC 61131-3)",systemd:"Systemd configuration file","t4-templating":"T4 templating","t4-cs":"T4 Text Templates (C#)",t4:"T4 Text Templates (C#)","t4-vb":"T4 Text Templates (VB)",tap:"TAP",tt2:"Template Toolkit 2",toml:"TOML",trig:"TriG",ts:"TypeScript",tsconfig:"TSConfig",uscript:"UnrealScript",uc:"UnrealScript",uri:"URI",url:"URL",vbnet:"VB.Net",vhdl:"VHDL",vim:"vim","visual-basic":"Visual Basic",vba:"VBA",vb:"Visual Basic",wasm:"WebAssembly",wiki:"Wiki markup",wolfram:"Wolfram language",nb:"Mathematica Notebook",wl:"Wolfram language",xeoracube:"XeoraCube","xml-doc":"XML doc (.net)",xojo:"Xojo (REALbasic)",xquery:"XQuery",yaml:"YAML",yml:"YAML",yang:"YANG"};Prism.plugins.toolbar.registerButton("show-language",function(e){var a=e.element.parentNode;if(a&&/pre/i.test(a.nodeName)){var t,s=a.getAttribute("data-language")||i[e.language]||((t=e.language)?(t.substring(0,1).toUpperCase()+t.substring(1)).replace(/s(?=cript)/,"S"):t);if(s){var o=document.createElement("span");return o.textContent=s,o}}})}else console.warn("Show Languages plugin loaded before Toolbar plugin.")}();
|
|
@ -0,0 +1,9 @@
|
|||
false
|
||||
true
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["boolean", "false"],
|
||||
["boolean", "true"]
|
||||
]
|
|
@ -0,0 +1,7 @@
|
|||
# comment
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["comment", "# comment"]
|
||||
]
|
|
@ -0,0 +1,71 @@
|
|||
Assert;
|
||||
Info;
|
||||
IsBound;
|
||||
QUIT;
|
||||
TryNextMethod;
|
||||
Unbind;
|
||||
and;
|
||||
atomic;
|
||||
break;
|
||||
continue;
|
||||
do;
|
||||
elif;
|
||||
else;
|
||||
end;
|
||||
fi;
|
||||
for;
|
||||
function;
|
||||
if;
|
||||
in;
|
||||
local;
|
||||
mod;
|
||||
not;
|
||||
od;
|
||||
or;
|
||||
quit;
|
||||
readonly;
|
||||
readwrite;
|
||||
rec;
|
||||
repeat;
|
||||
return;
|
||||
then;
|
||||
until;
|
||||
while;
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["keyword", "Assert"], ["punctuation", ";"],
|
||||
["keyword", "Info"], ["punctuation", ";"],
|
||||
["keyword", "IsBound"], ["punctuation", ";"],
|
||||
["keyword", "QUIT"], ["punctuation", ";"],
|
||||
["keyword", "TryNextMethod"], ["punctuation", ";"],
|
||||
["keyword", "Unbind"], ["punctuation", ";"],
|
||||
["keyword", "and"], ["punctuation", ";"],
|
||||
["keyword", "atomic"], ["punctuation", ";"],
|
||||
["keyword", "break"], ["punctuation", ";"],
|
||||
["keyword", "continue"], ["punctuation", ";"],
|
||||
["keyword", "do"], ["punctuation", ";"],
|
||||
["keyword", "elif"], ["punctuation", ";"],
|
||||
["keyword", "else"], ["punctuation", ";"],
|
||||
["keyword", "end"], ["punctuation", ";"],
|
||||
["keyword", "fi"], ["punctuation", ";"],
|
||||
["keyword", "for"], ["punctuation", ";"],
|
||||
["keyword", "function"], ["punctuation", ";"],
|
||||
["keyword", "if"], ["punctuation", ";"],
|
||||
["keyword", "in"], ["punctuation", ";"],
|
||||
["keyword", "local"], ["punctuation", ";"],
|
||||
["keyword", "mod"], ["punctuation", ";"],
|
||||
["keyword", "not"], ["punctuation", ";"],
|
||||
["keyword", "od"], ["punctuation", ";"],
|
||||
["keyword", "or"], ["punctuation", ";"],
|
||||
["keyword", "quit"], ["punctuation", ";"],
|
||||
["keyword", "readonly"], ["punctuation", ";"],
|
||||
["keyword", "readwrite"], ["punctuation", ";"],
|
||||
["keyword", "rec"], ["punctuation", ";"],
|
||||
["keyword", "repeat"], ["punctuation", ";"],
|
||||
["keyword", "return"], ["punctuation", ";"],
|
||||
["keyword", "then"], ["punctuation", ";"],
|
||||
["keyword", "until"], ["punctuation", ";"],
|
||||
["keyword", "while"], ["punctuation", ";"]
|
||||
]
|
|
@ -0,0 +1,43 @@
|
|||
0
|
||||
123134523423423412345132123123432744839127384723987497
|
||||
+123123
|
||||
-245435
|
||||
|
||||
66/123
|
||||
66/-123
|
||||
|
||||
3.14
|
||||
6.62606896e-34
|
||||
.1
|
||||
.1e1
|
||||
-.999
|
||||
1._
|
||||
1._l
|
||||
|
||||
[1..100]
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["number", "0"],
|
||||
["number", "123134523423423412345132123123432744839127384723987497"],
|
||||
["operator", "+"], ["number", "123123"],
|
||||
["operator", "-"], ["number", "245435"],
|
||||
|
||||
["number", "66"], ["operator", "/"], ["number", "123"],
|
||||
["number", "66"], ["operator", "/"], ["operator", "-"], ["number", "123"],
|
||||
|
||||
["number", "3.14"],
|
||||
["number", "6.62606896e-34"],
|
||||
["number", ".1"],
|
||||
["number", ".1e1"],
|
||||
["operator", "-"], ["number", ".999"],
|
||||
["number", "1._"],
|
||||
["number", "1._l"],
|
||||
|
||||
["punctuation", "["],
|
||||
["number", "1"],
|
||||
["operator", ".."],
|
||||
["number", "100"],
|
||||
["punctuation", "]"]
|
||||
]
|
|
@ -0,0 +1,34 @@
|
|||
+ - * / ^ ~
|
||||
= <> < > <= >=
|
||||
:= .. ->
|
||||
|
||||
!. ![ !{
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["operator", "+"],
|
||||
["operator", "-"],
|
||||
["operator", "*"],
|
||||
["operator", "/"],
|
||||
["operator", "^"],
|
||||
["operator", "~"],
|
||||
|
||||
["operator", "="],
|
||||
["operator", "<>"],
|
||||
["operator", "<"],
|
||||
["operator", ">"],
|
||||
["operator", "<="],
|
||||
["operator", ">="],
|
||||
|
||||
["operator", ":="],
|
||||
["operator", ".."],
|
||||
["operator", "->"],
|
||||
|
||||
["operator", "!"],
|
||||
["punctuation", "."],
|
||||
["operator", "!"],
|
||||
["punctuation", "["],
|
||||
["operator", "!"],
|
||||
["punctuation", "{"]
|
||||
]
|
|
@ -0,0 +1,18 @@
|
|||
( ) [ ] { }
|
||||
, ; . :
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["punctuation", "("],
|
||||
["punctuation", ")"],
|
||||
["punctuation", "["],
|
||||
["punctuation", "]"],
|
||||
["punctuation", "{"],
|
||||
["punctuation", "}"],
|
||||
|
||||
["punctuation", ","],
|
||||
["punctuation", ";"],
|
||||
["punctuation", "."],
|
||||
["punctuation", ":"]
|
||||
]
|
|
@ -0,0 +1,216 @@
|
|||
gap> i := 0;; s := 0;;
|
||||
gap> while s <= 200 do
|
||||
> i := i + 1; s := s + i^2;
|
||||
> od;
|
||||
gap> s;
|
||||
204
|
||||
gap> l := [ 1, 2, 3, 4, 5, 6 ];;
|
||||
gap> for i in l do
|
||||
> Print( i, " " );
|
||||
> l := [];
|
||||
> od; Print( "\n" );
|
||||
1 2 3 4 5 6
|
||||
gap> g := Group((1,2,3),(1,2));
|
||||
Group([ (1,2,3), (1,2) ])
|
||||
gap> for x in g do
|
||||
> if Order(x) = 3 then
|
||||
> continue;
|
||||
> fi; Print(x,"\n"); od;
|
||||
()
|
||||
(2,3)
|
||||
(1,3)
|
||||
(1,2)
|
||||
gap> continue;
|
||||
Syntax error: 'continue' statement not enclosed in a loop
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["shell", [
|
||||
["punctuation", "gap>"],
|
||||
["gap", [
|
||||
" i ",
|
||||
["operator", ":="],
|
||||
["number", "0"],
|
||||
["punctuation", ";"],
|
||||
["punctuation", ";"],
|
||||
" s ",
|
||||
["operator", ":="],
|
||||
["number", "0"],
|
||||
["punctuation", ";"],
|
||||
["punctuation", ";"]
|
||||
]]
|
||||
]],
|
||||
["shell", [
|
||||
["punctuation", "gap>"],
|
||||
["gap", [
|
||||
["keyword", "while"],
|
||||
" s ",
|
||||
["operator", "<="],
|
||||
["number", "200"],
|
||||
["keyword", "do"],
|
||||
|
||||
["continuation", ">"],
|
||||
" i ",
|
||||
["operator", ":="],
|
||||
" i ",
|
||||
["operator", "+"],
|
||||
["number", "1"],
|
||||
["punctuation", ";"],
|
||||
" s ",
|
||||
["operator", ":="],
|
||||
" s ",
|
||||
["operator", "+"],
|
||||
" i",
|
||||
["operator", "^"],
|
||||
["number", "2"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["continuation", ">"],
|
||||
["keyword", "od"],
|
||||
["punctuation", ";"]
|
||||
]]
|
||||
]],
|
||||
["shell", [
|
||||
["punctuation", "gap>"],
|
||||
["gap", [
|
||||
" s",
|
||||
["punctuation", ";"]
|
||||
]],
|
||||
|
||||
"\r\n204\r\n"
|
||||
]],
|
||||
["shell", [
|
||||
["punctuation", "gap>"],
|
||||
["gap", [
|
||||
" l ",
|
||||
["operator", ":="],
|
||||
["punctuation", "["],
|
||||
["number", "1"],
|
||||
["punctuation", ","],
|
||||
["number", "2"],
|
||||
["punctuation", ","],
|
||||
["number", "3"],
|
||||
["punctuation", ","],
|
||||
["number", "4"],
|
||||
["punctuation", ","],
|
||||
["number", "5"],
|
||||
["punctuation", ","],
|
||||
["number", "6"],
|
||||
["punctuation", "]"],
|
||||
["punctuation", ";"],
|
||||
["punctuation", ";"]
|
||||
]]
|
||||
]],
|
||||
["shell", [
|
||||
["punctuation", "gap>"],
|
||||
["gap", [
|
||||
["keyword", "for"],
|
||||
" i ",
|
||||
["keyword", "in"],
|
||||
" l ",
|
||||
["keyword", "do"],
|
||||
|
||||
["continuation", ">"],
|
||||
["function", "Print"],
|
||||
["punctuation", "("],
|
||||
" i",
|
||||
["punctuation", ","],
|
||||
["string", ["\" \""]],
|
||||
["punctuation", ")"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["continuation", ">"],
|
||||
" l ",
|
||||
["operator", ":="],
|
||||
["punctuation", "["],
|
||||
["punctuation", "]"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["continuation", ">"],
|
||||
["keyword", "od"],
|
||||
["punctuation", ";"],
|
||||
["function", "Print"],
|
||||
["punctuation", "("],
|
||||
["string", ["\"\\n\""]],
|
||||
["punctuation", ")"],
|
||||
["punctuation", ";"]
|
||||
]],
|
||||
|
||||
"\r\n1 2 3 4 5 6\r\n"
|
||||
]],
|
||||
["shell", [
|
||||
["punctuation", "gap>"],
|
||||
["gap", [
|
||||
" g ",
|
||||
["operator", ":="],
|
||||
["function", "Group"],
|
||||
["punctuation", "("],
|
||||
["punctuation", "("],
|
||||
["number", "1"],
|
||||
["punctuation", ","],
|
||||
["number", "2"],
|
||||
["punctuation", ","],
|
||||
["number", "3"],
|
||||
["punctuation", ")"],
|
||||
["punctuation", ","],
|
||||
["punctuation", "("],
|
||||
["number", "1"],
|
||||
["punctuation", ","],
|
||||
["number", "2"],
|
||||
["punctuation", ")"],
|
||||
["punctuation", ")"],
|
||||
["punctuation", ";"]
|
||||
]],
|
||||
|
||||
"\r\nGroup([ (1,2,3), (1,2) ])\r\n"
|
||||
]],
|
||||
["shell", [
|
||||
["punctuation", "gap>"],
|
||||
["gap", [
|
||||
["keyword", "for"],
|
||||
" x ",
|
||||
["keyword", "in"],
|
||||
" g ",
|
||||
["keyword", "do"],
|
||||
|
||||
["continuation", ">"],
|
||||
["keyword", "if"],
|
||||
["function", "Order"],
|
||||
["punctuation", "("],
|
||||
"x",
|
||||
["punctuation", ")"],
|
||||
["operator", "="],
|
||||
["number", "3"],
|
||||
["keyword", "then"],
|
||||
|
||||
["continuation", ">"],
|
||||
["keyword", "continue"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["continuation", ">"],
|
||||
["keyword", "fi"],
|
||||
["punctuation", ";"],
|
||||
["function", "Print"],
|
||||
["punctuation", "("],
|
||||
"x",
|
||||
["punctuation", ","],
|
||||
["string", ["\"\\n\""]],
|
||||
["punctuation", ")"],
|
||||
["punctuation", ";"],
|
||||
["keyword", "od"],
|
||||
["punctuation", ";"]
|
||||
]],
|
||||
|
||||
"\r\n()\r\n(2,3)\r\n(1,3)\r\n(1,2)\r\n"
|
||||
]],
|
||||
["shell", [
|
||||
["punctuation", "gap>"],
|
||||
["gap", [
|
||||
["keyword", "continue"],
|
||||
["punctuation", ";"]
|
||||
]],
|
||||
|
||||
"\r\nSyntax error: 'continue' statement not enclosed in a loop"
|
||||
]]
|
||||
]
|
|
@ -0,0 +1,27 @@
|
|||
'f'
|
||||
'\n'
|
||||
|
||||
""
|
||||
"foo"
|
||||
"\""
|
||||
|
||||
""""""
|
||||
""" foo """
|
||||
"""
|
||||
foo
|
||||
"""
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["string", ["'f'"]],
|
||||
["string", ["'\\n'"]],
|
||||
|
||||
["string", ["\"\""]],
|
||||
["string", ["\"foo\""]],
|
||||
["string", ["\"\\\"\""]],
|
||||
|
||||
["string", ["\"\"\"\"\"\""]],
|
||||
["string", ["\"\"\" foo \"\"\""]],
|
||||
["string", ["\"\"\"\r\nfoo\r\n\"\"\""]]
|
||||
]
|
Loading…
Reference in New Issue