1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-02-19 19:00:13 +02:00

Merge pull request #152 from pzl/monkeyc

Add MonkeyC & Jungle Lexers
This commit is contained in:
Alec Thomas 2018-06-25 20:05:21 +10:00 committed by GitHub
commit 1da70b26df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 621 additions and 0 deletions

50
lexers/j/jungle.go Normal file
View File

@ -0,0 +1,50 @@
package j
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
var Jungle = internal.Register(MustNewLexer(
&Config{
Name: "Jungle",
Aliases: []string{"jungle"},
Filenames: []string{"*.jungle"},
MimeTypes: []string{"text/x-jungle"},
},
Rules{
"root": {
{`[^\S\n]+`, Text, nil},
{`\n`, Text, nil},
{`#(\n|[\w\W]*?[^#]\n)`, CommentSingle, nil},
{`^(?=\S)`, None, Push("instruction")},
{`[\.;\[\]\(\)\$]`, Punctuation, nil},
{`[a-zA-Z_]\w*`, Name, nil},
},
"instruction": {
{`[^\S\n]+`, Text, nil},
{`=`, Operator, Push("value")},
{`(?=\S)`, None, Push("var")},
Default(Pop(1)),
},
"value": {
{`[^\S\n]+`, Text, nil},
{`\$\(`, Punctuation, Push("var")},
{`[;\[\]\(\)\$]`, Punctuation, nil},
{`#(\n|[\w\W]*?[^#]\n)`, CommentSingle, nil},
{`[\w_\-\.\/\\]+`, Text, nil},
Default(Pop(1)),
},
"var": {
{`[^\S\n]+`, Text, nil},
{`\b(((re)?source|barrel)Path|excludeAnnotations|annotations|lang)\b`, NameBuiltin, nil},
{`\bbase\b`, NameConstant, nil},
{`\b(ind|zsm|hrv|ces|dan|dut|eng|fin|fre|deu|gre|hun|ita|nob|po[lr]|rus|sl[ov]|spa|swe|ara|heb|zh[st]|jpn|kor|tha|vie|bul|tur)`, NameConstant, nil},
{`\b((semi)?round|rectangle)(-\d+x\d+)?\b`, NameConstant, nil},
{`[\.;\[\]\(\$]`, Punctuation, nil},
{`\)`, Punctuation, Pop(1)},
{`[a-zA-Z_]\w*`, Name, nil},
Default(Pop(1)),
},
},
))

62
lexers/m/monkeyc.go Normal file
View File

@ -0,0 +1,62 @@
package m
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
var MonkeyC = internal.Register(MustNewLexer(
&Config{
Name: "MonkeyC",
Aliases: []string{"monkeyc"},
Filenames: []string{"*.mc"},
MimeTypes: []string{"text/x-monkeyc"},
},
Rules{
"root": {
{`[^\S\n]+`, Text, nil},
{`\n`, Text, nil},
{`//(\n|[\w\W]*?[^\\]\n)`, CommentSingle, nil},
{`/(\\\n)?[*][\w\W]*?[*](\\\n)?/`, CommentMultiline, nil},
{`/(\\\n)?[*][\w\W]*`, CommentMultiline, nil},
{`:[a-zA-Z_][\w_\.]*`, StringSymbol, nil},
{`[{}\[\]\(\),;:\.]`, Punctuation, nil},
{`[&~\|\^!+\-*\/%=?]`, Operator, nil},
{`=>|[+-]=|&&|\|\||>>|<<|[<>]=?|[!=]=`, Operator, nil},
{`\b(and|or|instanceof|has|extends|new)`, OperatorWord, nil},
{Words(``, `\b`, `NaN`, `null`, `true`, `false`), KeywordConstant, nil},
{`(using)((?:\s|\\\\s)+)`, ByGroups(KeywordNamespace, Text), Push("import")},
{`(class)((?:\s|\\\\s)+)`, ByGroups(KeywordDeclaration, Text), Push("class")},
{`(function)((?:\s|\\\\s)+)`, ByGroups(KeywordDeclaration, Text), Push("function")},
{`(module)((?:\s|\\\\s)+)`, ByGroups(KeywordDeclaration, Text), Push("module")},
{`\b(if|else|for|switch|case|while|break|continue|default|do|try|catch|finally|return|throw|extends|function)\b`, Keyword, nil},
{`\b(const|enum|hidden|public|protected|private|static)\b`, KeywordType, nil},
{`\bvar\b`, KeywordDeclaration, nil},
{`\b(Activity(Monitor|Recording)?|Ant(Plus)?|Application|Attention|Background|Communications|Cryptography|FitContributor|Graphics|Gregorian|Lang|Math|Media|Persisted(Content|Locations)|Position|Properties|Sensor(History|Logging)?|Storage|StringUtil|System|Test|Time(r)?|Toybox|UserProfile|WatchUi|Rez|Drawables|Strings|Fonts|method)\b`, NameBuiltin, nil},
{`\b(me|self|\$)\b`, NameBuiltinPseudo, nil},
{`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil},
{`'(\\\\|\\'|[^''])*'`, LiteralStringSingle, nil},
{`-?(0x[0-9a-fA-F]+l?)`, NumberHex, nil},
{`-?([0-9]+(\.[0-9]+[df]?|[df]))\b`, NumberFloat, nil},
{`-?([0-9]+l?)`, NumberInteger, nil},
{`[a-zA-Z_]\w*`, Name, nil},
},
"import": {
{`([a-zA-Z_][\w_\.]*)(?:(\s+)(as)(\s+)([a-zA-Z_][\w_]*))?`, ByGroups(NameNamespace, Text, KeywordNamespace, Text, NameNamespace), nil},
Default(Pop(1)),
},
"class": {
{`([a-zA-Z_][\w_\.]*)(?:(\s+)(extends)(\s+)([a-zA-Z_][\w_\.]*))?`, ByGroups(NameClass, Text, KeywordDeclaration, Text, NameClass), nil},
Default(Pop(1)),
},
"function": {
{`initialize`, NameFunctionMagic, nil},
{`[a-zA-Z_][\w_\.]*`, NameFunction, nil},
Default(Pop(1)),
},
"module": {
{`[a-zA-Z_][\w_\.]*`, NameNamespace, nil},
Default(Pop(1)),
},
},
))

14
lexers/testdata/jungle.actual vendored Normal file
View File

@ -0,0 +1,14 @@
project.manifest = manifest.xml
#here is a comment
base.barrelPath = barrels
fr235.barrelPath = barrels/IconLibrary.barrel;barrels/GraphLibrary.barrel
fr645m.barrelPath = barrels/M.barrel;[A/A.jungle;A/B.jungle]
round-215x215.GraphLibrary.annotations = bar
round.resourcePath = $(base.resourcePath);resource-round
DigitsPicker = [..\ScreenPickers\monkey.jungle]
base.barrelPath = $(base.barrelPath);$(DigitsPicker)
d2bravo.resourcePath = $(d2bravo.resourcePath);resources-round-218x218-ciq_1.x;resources-ciq_1.x-no_hr
d2bravo_titanium.resourcePath = $(d2bravo_titanium.resourcePath);resources-round-218x218-ciq_1.x;resources-ciq_1.x

105
lexers/testdata/jungle.expected vendored Normal file
View File

@ -0,0 +1,105 @@
[
{"type":"Name","value":"project"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"manifest"},
{"type":"Text","value":" "},
{"type":"Operator","value":"="},
{"type":"Text","value":" manifest.xml\n\n"},
{"type":"CommentSingle","value":"#here is a comment\n"},
{"type":"NameConstant","value":"base"},
{"type":"Punctuation","value":"."},
{"type":"NameBuiltin","value":"barrelPath"},
{"type":"Text","value":" "},
{"type":"Operator","value":"="},
{"type":"Text","value":" barrels\n\n"},
{"type":"Name","value":"fr235"},
{"type":"Punctuation","value":"."},
{"type":"NameBuiltin","value":"barrelPath"},
{"type":"Text","value":" "},
{"type":"Operator","value":"="},
{"type":"Text","value":" barrels/IconLibrary.barrel"},
{"type":"Punctuation","value":";"},
{"type":"Text","value":"barrels/GraphLibrary.barrel\n"},
{"type":"Name","value":"fr645m"},
{"type":"Punctuation","value":"."},
{"type":"NameBuiltin","value":"barrelPath"},
{"type":"Text","value":" "},
{"type":"Operator","value":"="},
{"type":"Text","value":" barrels/M.barrel"},
{"type":"Punctuation","value":";["},
{"type":"Text","value":"A/A.jungle"},
{"type":"Punctuation","value":";"},
{"type":"Text","value":"A/B.jungle"},
{"type":"Punctuation","value":"]"},
{"type":"Text","value":"\n"},
{"type":"NameConstant","value":"round-215x215"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"GraphLibrary"},
{"type":"Punctuation","value":"."},
{"type":"NameBuiltin","value":"annotations"},
{"type":"Text","value":" "},
{"type":"Operator","value":"="},
{"type":"Text","value":" bar\n\n"},
{"type":"NameConstant","value":"round"},
{"type":"Punctuation","value":"."},
{"type":"NameBuiltin","value":"resourcePath"},
{"type":"Text","value":" "},
{"type":"Operator","value":"="},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"$("},
{"type":"NameConstant","value":"base"},
{"type":"Punctuation","value":"."},
{"type":"NameBuiltin","value":"resourcePath"},
{"type":"Punctuation","value":");"},
{"type":"Text","value":"resource-round\n"},
{"type":"Name","value":"DigitsPicker"},
{"type":"Text","value":" "},
{"type":"Operator","value":"="},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"["},
{"type":"Text","value":"..\\ScreenPickers\\monkey.jungle"},
{"type":"Punctuation","value":"]"},
{"type":"Text","value":"\n"},
{"type":"NameConstant","value":"base"},
{"type":"Punctuation","value":"."},
{"type":"NameBuiltin","value":"barrelPath"},
{"type":"Text","value":" "},
{"type":"Operator","value":"="},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"$("},
{"type":"NameConstant","value":"base"},
{"type":"Punctuation","value":"."},
{"type":"NameBuiltin","value":"barrelPath"},
{"type":"Punctuation","value":");$("},
{"type":"Name","value":"DigitsPicker"},
{"type":"Punctuation","value":")"},
{"type":"Text","value":"\n"},
{"type":"Name","value":"d2bravo"},
{"type":"Punctuation","value":"."},
{"type":"NameBuiltin","value":"resourcePath"},
{"type":"Text","value":" "},
{"type":"Operator","value":"="},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"$("},
{"type":"Name","value":"d2bravo"},
{"type":"Punctuation","value":"."},
{"type":"NameBuiltin","value":"resourcePath"},
{"type":"Punctuation","value":");"},
{"type":"Text","value":"resources-round-218x218-ciq_1.x"},
{"type":"Punctuation","value":";"},
{"type":"Text","value":"resources-ciq_1.x-no_hr\n"},
{"type":"Name","value":"d2bravo_titanium"},
{"type":"Punctuation","value":"."},
{"type":"NameBuiltin","value":"resourcePath"},
{"type":"Text","value":" "},
{"type":"Operator","value":"="},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"$("},
{"type":"Name","value":"d2bravo_titanium"},
{"type":"Punctuation","value":"."},
{"type":"NameBuiltin","value":"resourcePath"},
{"type":"Punctuation","value":");"},
{"type":"Text","value":"resources-round-218x218-ciq_1.x"},
{"type":"Punctuation","value":";"},
{"type":"Text","value":"resources-ciq_1.x\n"}
]

47
lexers/testdata/monkeyc.actual vendored Normal file
View File

@ -0,0 +1,47 @@
using Toybox.Application as App;
using Toybox.System;
const PI = 3.14;
class MyProjectApp extends App.AppBase {
protected var y;
function initialize () {
me.y = "Hello";
self.y = "World";
var x = add( 3, 4 );
var array = new [x];
// Initialize the sub-arrays
for( var i = 0; i < x; i += 1 ) {
array[i] = new [5];
}
var dict = { "a" => 1, "b" => 2 };
var person = { :firstName=>"Bob", :lastName=>"Jones" };
}
public function onStart(state) {
var v = new Foo();
var m = v.method(:op);
m.invoke(1,2l);
}
function getInitialView() {
return [ new MyProjectView() ];
}
function add( a, b ) {
return a + b;
}
function thisFunctionUsesAdd() {
var a = add( 1, 0x03f ); // Return 4
var b = add( "Hello ", "World" ); // Returns "Hello World"
}
}
class Foo {
function op(a, b) {}
}

343
lexers/testdata/monkeyc.expected vendored Normal file
View File

@ -0,0 +1,343 @@
[
{"type":"KeywordNamespace","value":"using"},
{"type":"Text","value":" "},
{"type":"NameNamespace","value":"Toybox.Application"},
{"type":"Text","value":" "},
{"type":"KeywordNamespace","value":"as"},
{"type":"Text","value":" "},
{"type":"NameNamespace","value":"App"},
{"type":"Punctuation","value":";"},
{"type":"Text","value":"\n"},
{"type":"KeywordNamespace","value":"using"},
{"type":"Text","value":" "},
{"type":"NameNamespace","value":"Toybox.System"},
{"type":"Punctuation","value":";"},
{"type":"Text","value":"\n\n"},
{"type":"KeywordType","value":"const"},
{"type":"Text","value":" "},
{"type":"Name","value":"PI"},
{"type":"Text","value":" "},
{"type":"Operator","value":"="},
{"type":"Text","value":" "},
{"type":"LiteralNumberFloat","value":"3.14"},
{"type":"Punctuation","value":";"},
{"type":"Text","value":"\n\n"},
{"type":"KeywordDeclaration","value":"class"},
{"type":"Text","value":" "},
{"type":"NameClass","value":"MyProjectApp"},
{"type":"Text","value":" "},
{"type":"KeywordDeclaration","value":"extends"},
{"type":"Text","value":" "},
{"type":"NameClass","value":"App.AppBase"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"Text","value":"\n "},
{"type":"KeywordType","value":"protected"},
{"type":"Text","value":" "},
{"type":"KeywordDeclaration","value":"var"},
{"type":"Text","value":" "},
{"type":"Name","value":"y"},
{"type":"Punctuation","value":";"},
{"type":"Text","value":"\n\n "},
{"type":"KeywordDeclaration","value":"function"},
{"type":"Text","value":" "},
{"type":"NameFunctionMagic","value":"initialize"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"()"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"Text","value":"\n "},
{"type":"NameBuiltinPseudo","value":"me"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"y"},
{"type":"Text","value":" "},
{"type":"Operator","value":"="},
{"type":"Text","value":" "},
{"type":"LiteralStringDouble","value":"\"Hello\""},
{"type":"Punctuation","value":";"},
{"type":"Text","value":"\n "},
{"type":"NameBuiltinPseudo","value":"self"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"y"},
{"type":"Text","value":" "},
{"type":"Operator","value":"="},
{"type":"Text","value":" "},
{"type":"LiteralStringDouble","value":"\"World\""},
{"type":"Punctuation","value":";"},
{"type":"Text","value":"\n "},
{"type":"KeywordDeclaration","value":"var"},
{"type":"Text","value":" "},
{"type":"Name","value":"x"},
{"type":"Text","value":" "},
{"type":"Operator","value":"="},
{"type":"Text","value":" "},
{"type":"Name","value":"add"},
{"type":"Punctuation","value":"("},
{"type":"Text","value":" "},
{"type":"LiteralNumberInteger","value":"3"},
{"type":"Punctuation","value":","},
{"type":"Text","value":" "},
{"type":"LiteralNumberInteger","value":"4"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":");"},
{"type":"Text","value":"\n "},
{"type":"KeywordDeclaration","value":"var"},
{"type":"Text","value":" "},
{"type":"Name","value":"array"},
{"type":"Text","value":" "},
{"type":"Operator","value":"="},
{"type":"Text","value":" "},
{"type":"OperatorWord","value":"new"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"["},
{"type":"Name","value":"x"},
{"type":"Punctuation","value":"];"},
{"type":"Text","value":"\n\n "},
{"type":"CommentSingle","value":"// Initialize the sub-arrays\n"},
{"type":"Text","value":" "},
{"type":"Keyword","value":"for"},
{"type":"Punctuation","value":"("},
{"type":"Text","value":" "},
{"type":"KeywordDeclaration","value":"var"},
{"type":"Text","value":" "},
{"type":"Name","value":"i"},
{"type":"Text","value":" "},
{"type":"Operator","value":"="},
{"type":"Text","value":" "},
{"type":"LiteralNumberInteger","value":"0"},
{"type":"Punctuation","value":";"},
{"type":"Text","value":" "},
{"type":"Name","value":"i"},
{"type":"Text","value":" "},
{"type":"Operator","value":"\u003c"},
{"type":"Text","value":" "},
{"type":"Name","value":"x"},
{"type":"Punctuation","value":";"},
{"type":"Text","value":" "},
{"type":"Name","value":"i"},
{"type":"Text","value":" "},
{"type":"Operator","value":"+="},
{"type":"Text","value":" "},
{"type":"LiteralNumberInteger","value":"1"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":")"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"Text","value":"\n "},
{"type":"Name","value":"array"},
{"type":"Punctuation","value":"["},
{"type":"Name","value":"i"},
{"type":"Punctuation","value":"]"},
{"type":"Text","value":" "},
{"type":"Operator","value":"="},
{"type":"Text","value":" "},
{"type":"OperatorWord","value":"new"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"["},
{"type":"LiteralNumberInteger","value":"5"},
{"type":"Punctuation","value":"];"},
{"type":"Text","value":"\n "},
{"type":"Punctuation","value":"}"},
{"type":"Text","value":"\n\n "},
{"type":"KeywordDeclaration","value":"var"},
{"type":"Text","value":" "},
{"type":"Name","value":"dict"},
{"type":"Text","value":" "},
{"type":"Operator","value":"="},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"Text","value":" "},
{"type":"LiteralStringDouble","value":"\"a\""},
{"type":"Text","value":" "},
{"type":"Operator","value":"=\u003e"},
{"type":"Text","value":" "},
{"type":"LiteralNumberInteger","value":"1"},
{"type":"Punctuation","value":","},
{"type":"Text","value":" "},
{"type":"LiteralStringDouble","value":"\"b\""},
{"type":"Text","value":" "},
{"type":"Operator","value":"=\u003e"},
{"type":"Text","value":" "},
{"type":"LiteralNumberInteger","value":"2"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"};"},
{"type":"Text","value":"\n "},
{"type":"KeywordDeclaration","value":"var"},
{"type":"Text","value":" "},
{"type":"Name","value":"person"},
{"type":"Text","value":" "},
{"type":"Operator","value":"="},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"Text","value":" "},
{"type":"LiteralStringSymbol","value":":firstName"},
{"type":"Operator","value":"=\u003e"},
{"type":"LiteralStringDouble","value":"\"Bob\""},
{"type":"Punctuation","value":","},
{"type":"Text","value":" "},
{"type":"LiteralStringSymbol","value":":lastName"},
{"type":"Operator","value":"=\u003e"},
{"type":"LiteralStringDouble","value":"\"Jones\""},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"};"},
{"type":"Text","value":"\n "},
{"type":"Punctuation","value":"}"},
{"type":"Text","value":"\n\n "},
{"type":"KeywordType","value":"public"},
{"type":"Text","value":" "},
{"type":"KeywordDeclaration","value":"function"},
{"type":"Text","value":" "},
{"type":"NameFunction","value":"onStart"},
{"type":"Punctuation","value":"("},
{"type":"Name","value":"state"},
{"type":"Punctuation","value":")"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"Text","value":"\n "},
{"type":"KeywordDeclaration","value":"var"},
{"type":"Text","value":" "},
{"type":"Name","value":"v"},
{"type":"Text","value":" "},
{"type":"Operator","value":"="},
{"type":"Text","value":" "},
{"type":"OperatorWord","value":"new"},
{"type":"Text","value":" "},
{"type":"Name","value":"Foo"},
{"type":"Punctuation","value":"();"},
{"type":"Text","value":"\n "},
{"type":"KeywordDeclaration","value":"var"},
{"type":"Text","value":" "},
{"type":"Name","value":"m"},
{"type":"Text","value":" "},
{"type":"Operator","value":"="},
{"type":"Text","value":" "},
{"type":"Name","value":"v"},
{"type":"Punctuation","value":"."},
{"type":"NameBuiltin","value":"method"},
{"type":"Punctuation","value":"("},
{"type":"LiteralStringSymbol","value":":op"},
{"type":"Punctuation","value":");"},
{"type":"Text","value":"\n "},
{"type":"Name","value":"m"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"invoke"},
{"type":"Punctuation","value":"("},
{"type":"LiteralNumberInteger","value":"1"},
{"type":"Punctuation","value":","},
{"type":"LiteralNumberInteger","value":"2l"},
{"type":"Punctuation","value":");"},
{"type":"Text","value":"\n "},
{"type":"Punctuation","value":"}"},
{"type":"Text","value":"\n\n "},
{"type":"KeywordDeclaration","value":"function"},
{"type":"Text","value":" "},
{"type":"NameFunction","value":"getInitialView"},
{"type":"Punctuation","value":"()"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"Text","value":"\n "},
{"type":"Keyword","value":"return"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"["},
{"type":"Text","value":" "},
{"type":"OperatorWord","value":"new"},
{"type":"Text","value":" "},
{"type":"Name","value":"MyProjectView"},
{"type":"Punctuation","value":"()"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"];"},
{"type":"Text","value":"\n "},
{"type":"Punctuation","value":"}"},
{"type":"Text","value":"\n\n "},
{"type":"KeywordDeclaration","value":"function"},
{"type":"Text","value":" "},
{"type":"NameFunction","value":"add"},
{"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":" "},
{"type":"Punctuation","value":"{"},
{"type":"Text","value":"\n "},
{"type":"Keyword","value":"return"},
{"type":"Text","value":" "},
{"type":"Name","value":"a"},
{"type":"Text","value":" "},
{"type":"Operator","value":"+"},
{"type":"Text","value":" "},
{"type":"Name","value":"b"},
{"type":"Punctuation","value":";"},
{"type":"Text","value":"\n "},
{"type":"Punctuation","value":"}"},
{"type":"Text","value":"\n\n "},
{"type":"KeywordDeclaration","value":"function"},
{"type":"Text","value":" "},
{"type":"NameFunction","value":"thisFunctionUsesAdd"},
{"type":"Punctuation","value":"()"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"Text","value":"\n "},
{"type":"KeywordDeclaration","value":"var"},
{"type":"Text","value":" "},
{"type":"Name","value":"a"},
{"type":"Text","value":" "},
{"type":"Operator","value":"="},
{"type":"Text","value":" "},
{"type":"Name","value":"add"},
{"type":"Punctuation","value":"("},
{"type":"Text","value":" "},
{"type":"LiteralNumberInteger","value":"1"},
{"type":"Punctuation","value":","},
{"type":"Text","value":" "},
{"type":"LiteralNumberHex","value":"0x03f"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":");"},
{"type":"Text","value":" "},
{"type":"CommentSingle","value":"// Return 4\n"},
{"type":"Text","value":" "},
{"type":"KeywordDeclaration","value":"var"},
{"type":"Text","value":" "},
{"type":"Name","value":"b"},
{"type":"Text","value":" "},
{"type":"Operator","value":"="},
{"type":"Text","value":" "},
{"type":"Name","value":"add"},
{"type":"Punctuation","value":"("},
{"type":"Text","value":" "},
{"type":"LiteralStringDouble","value":"\"Hello \""},
{"type":"Punctuation","value":","},
{"type":"Text","value":" "},
{"type":"LiteralStringDouble","value":"\"World\""},
{"type":"Text","value":" "},
{"type":"Punctuation","value":");"},
{"type":"Text","value":" "},
{"type":"CommentSingle","value":"// Returns \"Hello World\"\n"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"}"},
{"type":"Text","value":"\n \n"},
{"type":"Punctuation","value":"}"},
{"type":"Text","value":"\n\n"},
{"type":"KeywordDeclaration","value":"class"},
{"type":"Text","value":" "},
{"type":"NameClass","value":"Foo"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"Text","value":"\n "},
{"type":"KeywordDeclaration","value":"function"},
{"type":"Text","value":" "},
{"type":"NameFunction","value":"op"},
{"type":"Punctuation","value":"("},
{"type":"Name","value":"a"},
{"type":"Punctuation","value":","},
{"type":"Text","value":" "},
{"type":"Name","value":"b"},
{"type":"Punctuation","value":")"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"{}"},
{"type":"Text","value":"\n"},
{"type":"Punctuation","value":"}"}
]