diff --git a/lexers/embedded/sourcepawn.xml b/lexers/embedded/sourcepawn.xml new file mode 100644 index 000000000..caca401e3 --- /dev/null +++ b/lexers/embedded/sourcepawn.xml @@ -0,0 +1,59 @@ + + + SourcePawn + sp + *.sp + *.inc + text/x-sourcepawn + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lexers/testdata/sourcepawn.actual b/lexers/testdata/sourcepawn.actual new file mode 100644 index 000000000..a44d742d9 --- /dev/null +++ b/lexers/testdata/sourcepawn.actual @@ -0,0 +1,22 @@ +#include "a" +#include + +public void foo(); + +enum class E { A, B }; + +enum class { + a, b, + c, +} e; + +enum E { A, B }; + +class A { + void foo(); + void bar(); +}; + +int main() { + return 0 + 13 + 1.4; +} diff --git a/lexers/testdata/sourcepawn.expected b/lexers/testdata/sourcepawn.expected new file mode 100644 index 000000000..aef7d479e --- /dev/null +++ b/lexers/testdata/sourcepawn.expected @@ -0,0 +1,105 @@ +[ + {"type":"CommentPreproc","value":"#include"}, + {"type":"Text","value":" "}, + {"type":"CommentPreprocFile","value":"\"a\""}, + {"type":"CommentPreproc","value":"\n#include"}, + {"type":"Text","value":" "}, + {"type":"CommentPreprocFile","value":"\u003cb\u003e"}, + {"type":"CommentPreproc","value":"\n"}, + {"type":"Text","value":"\n"}, + {"type":"Keyword","value":"public"}, + {"type":"Text","value":" "}, + {"type":"KeywordType","value":"void"}, + {"type":"Text","value":" "}, + {"type":"Name","value":"foo"}, + {"type":"Punctuation","value":"();"}, + {"type":"Text","value":"\n\n"}, + {"type":"Keyword","value":"enum"}, + {"type":"Text","value":" "}, + {"type":"Name","value":"class"}, + {"type":"Text","value":" "}, + {"type":"Name","value":"E"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"{"}, + {"type":"Text","value":" "}, + {"type":"Name","value":"A"}, + {"type":"Punctuation","value":","}, + {"type":"Text","value":" "}, + {"type":"Name","value":"B"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"};"}, + {"type":"Text","value":"\n\n"}, + {"type":"Keyword","value":"enum"}, + {"type":"Text","value":" "}, + {"type":"Name","value":"class"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"{"}, + {"type":"Text","value":"\n "}, + {"type":"Name","value":"a"}, + {"type":"Punctuation","value":","}, + {"type":"Text","value":" "}, + {"type":"Name","value":"b"}, + {"type":"Punctuation","value":","}, + {"type":"Text","value":"\n "}, + {"type":"Name","value":"c"}, + {"type":"Punctuation","value":","}, + {"type":"Text","value":"\n"}, + {"type":"Punctuation","value":"}"}, + {"type":"Text","value":" "}, + {"type":"Name","value":"e"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n\n"}, + {"type":"Keyword","value":"enum"}, + {"type":"Text","value":" "}, + {"type":"Name","value":"E"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"{"}, + {"type":"Text","value":" "}, + {"type":"Name","value":"A"}, + {"type":"Punctuation","value":","}, + {"type":"Text","value":" "}, + {"type":"Name","value":"B"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"};"}, + {"type":"Text","value":"\n\n"}, + {"type":"Name","value":"class"}, + {"type":"Text","value":" "}, + {"type":"Name","value":"A"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"{"}, + {"type":"Text","value":"\n "}, + {"type":"KeywordType","value":"void"}, + {"type":"Text","value":" "}, + {"type":"Name","value":"foo"}, + {"type":"Punctuation","value":"();"}, + {"type":"Text","value":"\n "}, + {"type":"KeywordType","value":"void"}, + {"type":"Text","value":" "}, + {"type":"Name","value":"bar"}, + {"type":"Punctuation","value":"();"}, + {"type":"Text","value":"\n"}, + {"type":"Punctuation","value":"};"}, + {"type":"Text","value":"\n\n"}, + {"type":"KeywordType","value":"int"}, + {"type":"Text","value":" "}, + {"type":"Name","value":"main"}, + {"type":"Punctuation","value":"()"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"{"}, + {"type":"Text","value":"\n "}, + {"type":"Keyword","value":"return"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberInteger","value":"0"}, + {"type":"Text","value":" "}, + {"type":"Operator","value":"+"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberInteger","value":"13"}, + {"type":"Text","value":" "}, + {"type":"Operator","value":"+"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"1.4"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n"}, + {"type":"Punctuation","value":"}"}, + {"type":"Text","value":"\n"} +]