summaryrefslogtreecommitdiff
path: root/tests/examplefiles
diff options
context:
space:
mode:
authorDoug Torrance <dtorrance@piedmont.edu>2022-03-31 14:12:27 -0400
committerGitHub <noreply@github.com>2022-03-31 20:12:27 +0200
commitaa385f0d01ffca90a884900eb8b4d3a2942c094c (patch)
treeac0f6810041a8d099ac9820204186da224dd2190 /tests/examplefiles
parentbfa3f4f1a439faf3b2c05fad1b229e6c9351006f (diff)
downloadpygments-git-aa385f0d01ffca90a884900eb8b4d3a2942c094c.tar.gz
Add Macaulay2 lexer (#1791)
* Add Macaulay2 lexer * Update symbols for Macaulay2 1.18 * Match whitespace characters in Macaulay2 lexer * Add states for strings/comments in Macaulay2 lexer * Update Macaulay2 lexer tests for string/comment edge cases * Improve comment and string matching in Macaulay2 lexer Instead of matching each character one at a time, we match all characters without special meaning together. * Update Macaulay2 test output * Update Macaulay2 lexer symbols for 1.19 release * Move "auto-generated" comment in Macaulay2 lexer down a few lines * Fix underline length in Macaulay2 lexer docstring * Add url field for Macaulay2 lexer * Bump copyright year for Macaulay2 lexer
Diffstat (limited to 'tests/examplefiles')
-rw-r--r--tests/examplefiles/macaulay2/test.m223
-rw-r--r--tests/examplefiles/macaulay2/test.m2.output84
2 files changed, 107 insertions, 0 deletions
diff --git a/tests/examplefiles/macaulay2/test.m2 b/tests/examplefiles/macaulay2/test.m2
new file mode 100644
index 00000000..3bf0cf28
--- /dev/null
+++ b/tests/examplefiles/macaulay2/test.m2
@@ -0,0 +1,23 @@
+"this is a string"
+
+"this is how we \"escape quotes\" in a string"
+
+"this is how " | "we concatenate strings"
+
+///this is also
+a string///
+
+///to escape forward slashes (/) in a string, we
+use an even number in the middle //// or an odd number
+(at least 3) at the end///
+
+-- this is a comment
+
+-* this is
+also a comment *-
+
+-* two comments *- 2 + 2 -* on the same line *-
+
+for i from 0 to 10 do print QQ
+
+end
diff --git a/tests/examplefiles/macaulay2/test.m2.output b/tests/examplefiles/macaulay2/test.m2.output
new file mode 100644
index 00000000..1042273e
--- /dev/null
+++ b/tests/examplefiles/macaulay2/test.m2.output
@@ -0,0 +1,84 @@
+'"' Literal.String
+'this is a string' Literal.String
+'"' Literal.String
+'\n\n' Text.Whitespace
+
+'"' Literal.String
+'this is how we ' Literal.String
+'\\"' Literal.String
+'escape quotes' Literal.String
+'\\"' Literal.String
+' in a string' Literal.String
+'"' Literal.String
+'\n\n' Text.Whitespace
+
+'"' Literal.String
+'this is how ' Literal.String
+'"' Literal.String
+' ' Text.Whitespace
+'|' Text
+' ' Text.Whitespace
+'"' Literal.String
+'we concatenate strings' Literal.String
+'"' Literal.String
+'\n\n' Text.Whitespace
+
+'///' Literal.String
+'this is also\na string' Literal.String
+'///' Literal.String
+'\n\n' Text.Whitespace
+
+'///' Literal.String
+'to escape forward slashes (' Literal.String
+'/' Literal.String
+') in a string, we\nuse an even number in the middle ' Literal.String
+'////' Literal.String
+' or an odd number\n(at least 3) at the end' Literal.String
+'///' Literal.String
+'\n\n' Text.Whitespace
+
+'-- this is a comment' Comment.Single
+'\n\n' Text.Whitespace
+
+'-*' Comment.Multiline
+' this is\nalso a comment ' Comment.Multiline
+'*-' Comment.Multiline
+'\n\n' Text.Whitespace
+
+'-*' Comment.Multiline
+' two comments ' Comment.Multiline
+'*-' Comment.Multiline
+' ' Text.Whitespace
+'2' Text
+' ' Text.Whitespace
+'+' Text
+' ' Text.Whitespace
+'2' Text
+' ' Text.Whitespace
+'-*' Comment.Multiline
+' on the same line ' Comment.Multiline
+'*-' Comment.Multiline
+'\n\n' Text.Whitespace
+
+'for' Keyword
+' ' Text.Whitespace
+'i' Text
+' ' Text.Whitespace
+'from' Keyword
+' ' Text.Whitespace
+'0' Text
+' ' Text.Whitespace
+'to' Keyword
+' ' Text.Whitespace
+'1' Text
+'0' Text
+' ' Text.Whitespace
+'do' Keyword
+' ' Text.Whitespace
+'print' Name.Function
+' ' Text.Whitespace
+'QQ' Name.Builtin
+'\n\n' Text.Whitespace
+
+'end' Name.Constant
+'\n' Text.Whitespace