summaryrefslogtreecommitdiff
path: root/tests/lexers/gap
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lexers/gap')
-rw-r--r--tests/lexers/gap/example.txt682
-rw-r--r--tests/lexers/gap/example2.txt120
2 files changed, 802 insertions, 0 deletions
diff --git a/tests/lexers/gap/example.txt b/tests/lexers/gap/example.txt
new file mode 100644
index 00000000..a32bdaeb
--- /dev/null
+++ b/tests/lexers/gap/example.txt
@@ -0,0 +1,682 @@
+---input---
+#############################################################################
+##
+#W example.gd
+##
+## This file contains a sample of a GAP implementation file.
+##
+
+
+#############################################################################
+##
+#M SomeOperation( <val> )
+##
+## performs some operation on <val>
+##
+InstallMethod( SomeProperty,
+ "for left modules",
+ [ IsLeftModule ], 0,
+ function( M )
+ if IsFreeLeftModule( M ) and not IsTrivial( M ) then
+ return true;
+ fi;
+ TryNextMethod();
+ end );
+
+
+
+#############################################################################
+##
+#F SomeGlobalFunction( )
+##
+## A global variadic funfion.
+##
+InstallGlobalFunction( SomeGlobalFunction, function( arg )
+ if Length( arg ) = 3 then
+ return arg[1] + arg[2] * arg[3];
+ elif Length( arg ) = 2 then
+ return arg[1] - arg[2]
+ else
+ Error( "usage: SomeGlobalFunction( <x>, <y>[, <z>] )" );
+ fi;
+ end );
+
+
+#
+# A plain function.
+#
+SomeFunc := function(x, y)
+ local z, func, tmp, j;
+ z := x * 1.0;
+ y := 17^17 - y;
+ func := a -> a mod 5;
+ tmp := List( [1..50], func );
+ while y > 0 do
+ for j in tmp do
+ Print(j, "\n");
+ od;
+ repeat
+ y := y - 1;
+ until 0 < 1;
+ y := y -1;
+ od;
+ return z;
+end;
+
+
+---tokens---
+'#############################################################################' Comment.Single
+'\n' Text
+
+'##' Comment.Single
+'\n' Text
+
+'#W example.gd' Comment.Single
+'\n' Text
+
+'##' Comment.Single
+'\n' Text
+
+'## This file contains a sample of a GAP implementation file.' Comment.Single
+'\n' Text
+
+'##' Comment.Single
+'\n' Text
+
+'\n' Text
+
+'\n' Text
+
+'#############################################################################' Comment.Single
+'\n' Text
+
+'##' Comment.Single
+'\n' Text
+
+'#M SomeOperation( <val> )' Comment.Single
+'\n' Text
+
+'##' Comment.Single
+'\n' Text
+
+'## performs some operation on <val>' Comment.Single
+'\n' Text
+
+'##' Comment.Single
+'\n' Text
+
+'InstallMethod' Name.Builtin
+'(' Punctuation
+' ' Text
+'SomeProperty' Name.Variable
+',' Operator
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'"for left modules"' Literal.String
+',' Operator
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'[' Punctuation
+' ' Text
+'IsLeftModule' Name.Variable
+' ' Text
+']' Punctuation
+',' Operator
+' ' Text
+'0' Name.Variable
+',' Operator
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'function' Keyword
+'(' Punctuation
+' ' Text
+'M' Name.Variable
+' ' Text
+')' Punctuation
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'if' Keyword
+' ' Text
+'IsFreeLeftModule' Name.Variable
+'(' Punctuation
+' ' Text
+'M' Name.Variable
+' ' Text
+')' Punctuation
+' ' Text
+'and' Operator.Word
+' ' Text
+'not' Operator.Word
+' ' Text
+'IsTrivial' Name.Variable
+'(' Punctuation
+' ' Text
+'M' Name.Variable
+' ' Text
+')' Punctuation
+' ' Text
+'then' Keyword
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'return' Keyword
+' ' Text
+'true' Name.Constant
+';' Operator
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'fi' Keyword
+';' Operator
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'TryNextMethod' Keyword
+'(' Punctuation
+')' Punctuation
+';' Operator
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'end' Keyword
+' ' Text
+')' Punctuation
+';' Operator
+'\n' Text
+
+'\n' Text
+
+'\n' Text
+
+'\n' Text
+
+'#############################################################################' Comment.Single
+'\n' Text
+
+'##' Comment.Single
+'\n' Text
+
+'#F SomeGlobalFunction( )' Comment.Single
+'\n' Text
+
+'##' Comment.Single
+'\n' Text
+
+'## A global variadic funfion.' Comment.Single
+'\n' Text
+
+'##' Comment.Single
+'\n' Text
+
+'InstallGlobalFunction' Name.Builtin
+'(' Punctuation
+' ' Text
+'SomeGlobalFunction' Name.Variable
+',' Operator
+' ' Text
+'function' Keyword
+'(' Punctuation
+' ' Text
+'arg' Name.Variable
+' ' Text
+')' Punctuation
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'if' Keyword
+' ' Text
+'Length' Name.Variable
+'(' Punctuation
+' ' Text
+'arg' Name.Variable
+' ' Text
+')' Punctuation
+' ' Text
+'=' Operator
+' ' Text
+'3' Name.Variable
+' ' Text
+'then' Keyword
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'return' Keyword
+' ' Text
+'arg' Name.Variable
+'[' Punctuation
+'1' Name.Variable
+']' Punctuation
+' ' Text
+'+' Operator
+' ' Text
+'arg' Name.Variable
+'[' Punctuation
+'2' Name.Variable
+']' Punctuation
+' ' Text
+'*' Operator
+' ' Text
+'arg' Name.Variable
+'[' Punctuation
+'3' Name.Variable
+']' Punctuation
+';' Operator
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'elif' Keyword
+' ' Text
+'Length' Name.Variable
+'(' Punctuation
+' ' Text
+'arg' Name.Variable
+' ' Text
+')' Punctuation
+' ' Text
+'=' Operator
+' ' Text
+'2' Name.Variable
+' ' Text
+'then' Keyword
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'return' Keyword
+' ' Text
+'arg' Name.Variable
+'[' Punctuation
+'1' Name.Variable
+']' Punctuation
+' ' Text
+'-' Operator
+' ' Text
+'arg' Name.Variable
+'[' Punctuation
+'2' Name.Variable
+']' Punctuation
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'else' Keyword
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'Error' Name.Variable
+'(' Punctuation
+' ' Text
+'"usage: SomeGlobalFunction( <x>, <y>[, <z>] )"' Literal.String
+' ' Text
+')' Punctuation
+';' Operator
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'fi' Keyword
+';' Operator
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'end' Keyword
+' ' Text
+')' Punctuation
+';' Operator
+'\n' Text
+
+'\n' Text
+
+'\n' Text
+
+'#' Comment.Single
+'\n' Text
+
+'# A plain function.' Comment.Single
+'\n' Text
+
+'#' Comment.Single
+'\n' Text
+
+'SomeFunc' Name.Variable
+' ' Text
+':=' Operator
+' ' Text
+'function' Keyword
+'(' Punctuation
+'x' Name.Variable
+',' Operator
+' ' Text
+'y' Name.Variable
+')' Punctuation
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'local' Keyword
+' ' Text
+'z' Name.Variable
+',' Operator
+' ' Text
+'func' Name.Variable
+',' Operator
+' ' Text
+'tmp' Name.Variable
+',' Operator
+' ' Text
+'j' Name.Variable
+';' Operator
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'z' Name.Variable
+' ' Text
+':=' Operator
+' ' Text
+'x' Name.Variable
+' ' Text
+'*' Operator
+' ' Text
+'1' Name.Variable
+'.' Operator
+'0' Name.Variable
+';' Operator
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'y' Name.Variable
+' ' Text
+':=' Operator
+' ' Text
+'17' Name.Variable
+'^' Operator
+'17' Name.Variable
+' ' Text
+'-' Operator
+' ' Text
+'y' Name.Variable
+';' Operator
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'func' Name.Variable
+' ' Text
+':=' Operator
+' ' Text
+'a' Name.Variable
+' ' Text
+'-' Operator
+'>' Operator
+' ' Text
+'a' Name.Variable
+' ' Text
+'mod' Operator.Word
+' ' Text
+'5' Name.Variable
+';' Operator
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'tmp' Name.Variable
+' ' Text
+':=' Operator
+' ' Text
+'List' Name.Variable
+'(' Punctuation
+' ' Text
+'[' Punctuation
+'1' Name.Variable
+'.' Operator
+'.' Operator
+'50' Name.Variable
+']' Punctuation
+',' Operator
+' ' Text
+'func' Name.Variable
+' ' Text
+')' Punctuation
+';' Operator
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'while' Keyword
+' ' Text
+'y' Name.Variable
+' ' Text
+'>' Operator
+' ' Text
+'0' Name.Variable
+' ' Text
+'do' Keyword
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'for' Keyword
+' ' Text
+'j' Name.Variable
+' ' Text
+'in' Operator.Word
+' ' Text
+'tmp' Name.Variable
+' ' Text
+'do' Keyword
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'Print' Name.Variable
+'(' Punctuation
+'j' Name.Variable
+',' Operator
+' ' Text
+'"\\n"' Literal.String
+')' Punctuation
+';' Operator
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'od' Keyword
+';' Operator
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'repeat' Keyword
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'y' Name.Variable
+' ' Text
+':=' Operator
+' ' Text
+'y' Name.Variable
+' ' Text
+'-' Operator
+' ' Text
+'1' Name.Variable
+';' Operator
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'until' Keyword
+' ' Text
+'0' Name.Variable
+' ' Text
+'<' Operator
+' ' Text
+'1' Name.Variable
+';' Operator
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'y' Name.Variable
+' ' Text
+':=' Operator
+' ' Text
+'y' Name.Variable
+' ' Text
+'-' Operator
+'1' Name.Variable
+';' Operator
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'od' Keyword
+';' Operator
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'return' Keyword
+' ' Text
+'z' Name.Variable
+';' Operator
+'\n' Text
+
+'end' Keyword
+';' Operator
+'\n' Text
+
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'\n' Text
diff --git a/tests/lexers/gap/example2.txt b/tests/lexers/gap/example2.txt
new file mode 100644
index 00000000..87b35675
--- /dev/null
+++ b/tests/lexers/gap/example2.txt
@@ -0,0 +1,120 @@
+---input---
+#############################################################################
+##
+#W example.gd
+##
+## This file contains a sample of a GAP declaration file.
+##
+DeclareProperty( "SomeProperty", IsLeftModule );
+DeclareGlobalFunction( "SomeGlobalFunction" );
+
+
+#############################################################################
+##
+#C IsQuuxFrobnicator(<R>)
+##
+## <ManSection>
+## <Filt Name="IsQuuxFrobnicator" Arg='R' Type='Category'/>
+##
+## <Description>
+## Tests whether R is a quux frobnicator.
+## </Description>
+## </ManSection>
+##
+DeclareSynonym( "IsQuuxFrobnicator", IsField and IsGroup );
+
+---tokens---
+'#############################################################################' Comment.Single
+'\n' Text
+
+'##' Comment.Single
+'\n' Text
+
+'#W example.gd' Comment.Single
+'\n' Text
+
+'##' Comment.Single
+'\n' Text
+
+'## This file contains a sample of a GAP declaration file.' Comment.Single
+'\n' Text
+
+'##' Comment.Single
+'\n' Text
+
+'DeclareProperty' Name.Builtin
+'(' Punctuation
+' ' Text
+'"SomeProperty"' Literal.String
+',' Operator
+' ' Text
+'IsLeftModule' Name.Variable
+' ' Text
+')' Punctuation
+';' Operator
+'\n' Text
+
+'DeclareGlobalFunction' Name.Builtin
+'(' Punctuation
+' ' Text
+'"SomeGlobalFunction"' Literal.String
+' ' Text
+')' Punctuation
+';' Operator
+'\n' Text
+
+'\n' Text
+
+'\n' Text
+
+'#############################################################################' Comment.Single
+'\n' Text
+
+'##' Comment.Single
+'\n' Text
+
+'#C IsQuuxFrobnicator(<R>)' Comment.Single
+'\n' Text
+
+'##' Comment.Single
+'\n' Text
+
+'## <ManSection>' Comment.Single
+'\n' Text
+
+'## <Filt Name="IsQuuxFrobnicator" Arg=\'R\' Type=\'Category\'/>' Comment.Single
+'\n' Text
+
+'##' Comment.Single
+'\n' Text
+
+'## <Description>' Comment.Single
+'\n' Text
+
+'## Tests whether R is a quux frobnicator.' Comment.Single
+'\n' Text
+
+'## </Description>' Comment.Single
+'\n' Text
+
+'## </ManSection>' Comment.Single
+'\n' Text
+
+'##' Comment.Single
+'\n' Text
+
+'DeclareSynonym' Name.Builtin
+'(' Punctuation
+' ' Text
+'"IsQuuxFrobnicator"' Literal.String
+',' Operator
+' ' Text
+'IsField' Name.Variable
+' ' Text
+'and' Operator.Word
+' ' Text
+'IsGroup' Name.Variable
+' ' Text
+')' Punctuation
+';' Operator
+'\n' Text