summaryrefslogtreecommitdiff
path: root/tests/lexers/prolog
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lexers/prolog')
-rw-r--r--tests/lexers/prolog/example.txt181
-rw-r--r--tests/lexers/prolog/example2.txt164
2 files changed, 345 insertions, 0 deletions
diff --git a/tests/lexers/prolog/example.txt b/tests/lexers/prolog/example.txt
new file mode 100644
index 00000000..13e2cb1f
--- /dev/null
+++ b/tests/lexers/prolog/example.txt
@@ -0,0 +1,181 @@
+---input---
+partition([], _, [], []).
+partition([X|Xs], Pivot, Smalls, Bigs) :-
+ ( X @< Pivot ->
+ Smalls = [X|Rest],
+ partition(Xs, Pivot, Rest, Bigs)
+ ; Bigs = [X|Rest],
+ partition(Xs, Pivot, Smalls, Rest)
+ ).
+
+quicksort([]) --> [].
+quicksort([X|Xs]) -->
+ { partition(Xs, X, Smaller, Bigger) },
+ quicksort(Smaller), [X], quicksort(Bigger).
+
+---tokens---
+'partition' Name.Function
+'(' Punctuation
+'[' Punctuation
+']' Punctuation
+',' Punctuation
+' ' Text
+'_' Keyword
+',' Punctuation
+' ' Text
+'[' Punctuation
+']' Punctuation
+',' Punctuation
+' ' Text
+'[' Punctuation
+']' Punctuation
+')' Punctuation
+'.' Punctuation
+'\n' Text
+
+'partition' Name.Function
+'(' Punctuation
+'[' Punctuation
+'X' Name.Variable
+'|' Punctuation
+'Xs' Name.Variable
+']' Punctuation
+',' Punctuation
+' ' Text
+'Pivot' Name.Variable
+',' Punctuation
+' ' Text
+'Smalls' Name.Variable
+',' Punctuation
+' ' Text
+'Bigs' Name.Variable
+')' Punctuation
+' ' Text
+':-' Punctuation
+'\n ' Text
+'(' Punctuation
+' ' Text
+'X' Name.Variable
+' ' Text
+'@<' Literal.String.Atom
+' ' Text
+'Pivot' Name.Variable
+' ' Text
+'->' Literal.String.Atom
+'\n ' Text
+'Smalls' Name.Variable
+' ' Text
+'=' Operator
+' ' Text
+'[' Punctuation
+'X' Name.Variable
+'|' Punctuation
+'Rest' Name.Variable
+']' Punctuation
+',' Punctuation
+'\n ' Text
+'partition' Name.Function
+'(' Punctuation
+'Xs' Name.Variable
+',' Punctuation
+' ' Text
+'Pivot' Name.Variable
+',' Punctuation
+' ' Text
+'Rest' Name.Variable
+',' Punctuation
+' ' Text
+'Bigs' Name.Variable
+')' Punctuation
+'\n ' Text
+';' Punctuation
+' ' Text
+'Bigs' Name.Variable
+' ' Text
+'=' Operator
+' ' Text
+'[' Punctuation
+'X' Name.Variable
+'|' Punctuation
+'Rest' Name.Variable
+']' Punctuation
+',' Punctuation
+'\n ' Text
+'partition' Name.Function
+'(' Punctuation
+'Xs' Name.Variable
+',' Punctuation
+' ' Text
+'Pivot' Name.Variable
+',' Punctuation
+' ' Text
+'Smalls' Name.Variable
+',' Punctuation
+' ' Text
+'Rest' Name.Variable
+')' Punctuation
+'\n ' Text
+')' Punctuation
+'.' Punctuation
+'\n\n' Text
+
+'quicksort' Name.Function
+'(' Punctuation
+'[' Punctuation
+']' Punctuation
+')' Punctuation
+' ' Text
+'-->' Punctuation
+' ' Text
+'[' Punctuation
+']' Punctuation
+'.' Punctuation
+'\n' Text
+
+'quicksort' Name.Function
+'(' Punctuation
+'[' Punctuation
+'X' Name.Variable
+'|' Punctuation
+'Xs' Name.Variable
+']' Punctuation
+')' Punctuation
+' ' Text
+'-->' Punctuation
+' \n ' Text
+'{' Punctuation
+' ' Text
+'partition' Name.Function
+'(' Punctuation
+'Xs' Name.Variable
+',' Punctuation
+' ' Text
+'X' Name.Variable
+',' Punctuation
+' ' Text
+'Smaller' Name.Variable
+',' Punctuation
+' ' Text
+'Bigger' Name.Variable
+')' Punctuation
+' ' Text
+'}' Punctuation
+',' Punctuation
+'\n ' Text
+'quicksort' Name.Function
+'(' Punctuation
+'Smaller' Name.Variable
+')' Punctuation
+',' Punctuation
+' ' Text
+'[' Punctuation
+'X' Name.Variable
+']' Punctuation
+',' Punctuation
+' ' Text
+'quicksort' Name.Function
+'(' Punctuation
+'Bigger' Name.Variable
+')' Punctuation
+'.' Punctuation
+'\n' Text
diff --git a/tests/lexers/prolog/example2.txt b/tests/lexers/prolog/example2.txt
new file mode 100644
index 00000000..4e5b88af
--- /dev/null
+++ b/tests/lexers/prolog/example2.txt
@@ -0,0 +1,164 @@
+---input---
+/* Comments /* can nest */
+still a comment
+*/
+
+:- module(maplist, maplist/3)
+
+assert(world:done). % asserts
+
+sibling(X, Y) :- parent_child(Z, X), parent_child(Z, Y).
+
+parent_child(X, Y) :- father_child(X, Y).
+parent_child(X, Y) :- mother_child(X, Y).
+
+mother_child(trude, sally).
+
+father_child(tom, sally).
+father_child(tom, erica).
+father_child(mike, tom).
+
+
+---tokens---
+'/*' Comment.Multiline
+' Comments ' Comment.Multiline
+'/*' Comment.Multiline
+' can nest ' Comment.Multiline
+'*/' Comment.Multiline
+'\nstill a comment\n' Comment.Multiline
+
+'*/' Comment.Multiline
+'\n\n' Text
+
+':-' Punctuation
+' ' Text
+'module' Name.Function
+'(' Punctuation
+'maplist' Literal.String.Atom
+',' Punctuation
+' ' Text
+'maplist' Literal.String.Atom
+'/' Operator
+'3' Literal.Number.Integer
+')' Punctuation
+'\n\n' Text
+
+'assert' Name.Function
+'(' Punctuation
+'world' Name.Namespace
+':' Punctuation
+'done' Literal.String.Atom
+')' Punctuation
+'.' Punctuation
+' ' Text
+'% asserts' Comment.Single
+'\n\n' Text
+
+'sibling' Name.Function
+'(' Punctuation
+'X' Name.Variable
+',' Punctuation
+' ' Text
+'Y' Name.Variable
+')' Punctuation
+' ' Text
+':-' Punctuation
+' ' Text
+'parent_child' Name.Function
+'(' Punctuation
+'Z' Name.Variable
+',' Punctuation
+' ' Text
+'X' Name.Variable
+')' Punctuation
+',' Punctuation
+' ' Text
+'parent_child' Name.Function
+'(' Punctuation
+'Z' Name.Variable
+',' Punctuation
+' ' Text
+'Y' Name.Variable
+')' Punctuation
+'.' Punctuation
+'\n\n' Text
+
+'parent_child' Name.Function
+'(' Punctuation
+'X' Name.Variable
+',' Punctuation
+' ' Text
+'Y' Name.Variable
+')' Punctuation
+' ' Text
+':-' Punctuation
+' ' Text
+'father_child' Name.Function
+'(' Punctuation
+'X' Name.Variable
+',' Punctuation
+' ' Text
+'Y' Name.Variable
+')' Punctuation
+'.' Punctuation
+'\n' Text
+
+'parent_child' Name.Function
+'(' Punctuation
+'X' Name.Variable
+',' Punctuation
+' ' Text
+'Y' Name.Variable
+')' Punctuation
+' ' Text
+':-' Punctuation
+' ' Text
+'mother_child' Name.Function
+'(' Punctuation
+'X' Name.Variable
+',' Punctuation
+' ' Text
+'Y' Name.Variable
+')' Punctuation
+'.' Punctuation
+'\n\n' Text
+
+'mother_child' Name.Function
+'(' Punctuation
+'trude' Literal.String.Atom
+',' Punctuation
+' ' Text
+'sally' Literal.String.Atom
+')' Punctuation
+'.' Punctuation
+'\n\n' Text
+
+'father_child' Name.Function
+'(' Punctuation
+'tom' Literal.String.Atom
+',' Punctuation
+' ' Text
+'sally' Literal.String.Atom
+')' Punctuation
+'.' Punctuation
+'\n' Text
+
+'father_child' Name.Function
+'(' Punctuation
+'tom' Literal.String.Atom
+',' Punctuation
+' ' Text
+'erica' Literal.String.Atom
+')' Punctuation
+'.' Punctuation
+'\n' Text
+
+'father_child' Name.Function
+'(' Punctuation
+'mike' Literal.String.Atom
+',' Punctuation
+' ' Text
+'tom' Literal.String.Atom
+')' Punctuation
+'.' Punctuation
+'\n' Text