-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Contribute TextMate grammar for jikespg grammars
jikespg is the parser generator used in ECJ. This TextMate grammar provides basic syntax highlighting for the grammar files that jikespg uses. In order to try out this grammar, try editing https://github.com/eclipse-jdt/eclipse.jdt.core/blob/master/org.eclipse.jdt.core.compiler.batch/grammar/java.g , or try editing some of the example grammars in the jikespg repo: https://github.com/daveshields/jikespg I wrote this grammar. It doesn't come from the VS Code repository, so it can't be auto-updated from there. Signed-off-by: David Thompson <davthomp@redhat.com>
- Loading branch information
Showing
3 changed files
with
205 additions
and
1 deletion.
There are no files selected for viewing
167 changes: 167 additions & 0 deletions
167
org.eclipse.tm4e.language_pack/jikespg/jikespg.tmLanguage.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", | ||
"name": "Jikespg Grammar", | ||
"fileTypes": [ | ||
"g" | ||
], | ||
"patterns": [ | ||
{ | ||
"include": "#keywords" | ||
}, | ||
{ | ||
"include": "#options" | ||
}, | ||
{ | ||
"include": "#sections" | ||
}, | ||
{ | ||
"include": "#comments" | ||
}, | ||
{ | ||
"include": "#embeddedCode" | ||
}, | ||
{ | ||
"include": "#macro" | ||
}, | ||
{ | ||
"include": "#productions" | ||
} | ||
], | ||
"repository": { | ||
"keywords": { | ||
"patterns": [ | ||
{ | ||
"name": "keyword.control.jikespg", | ||
"match": "\\b(?<=\\$)([Dd][Ee][Ff][Ii][Nn][Ee]|[Ee][Mm][Pp][Tt][Yy]|[Ee][Rr][Rr][Oo][Rr]|[Ee][Oo][Ll]|[Ee][Oo][Ff]|[Ee][Nn][Dd]|[Rr][Uu][Ll][Ee][Ss]|[Aa][Ll][Ii][Aa][Ss]|[Ss][Tt][Aa][Rr][Tt]|[Nn][Aa][Mm][Ee][Ss])\\b", | ||
"comment": "Dollar prefixed keywords. keywords are case insensitive" | ||
} | ||
] | ||
}, | ||
"comments": { | ||
"patterns": [ | ||
{ | ||
"name": "comment.line.double-dash.jikespg", | ||
"match": "(?<!')(--.*)" | ||
} | ||
] | ||
}, | ||
"options": { | ||
"patterns": [ | ||
{ | ||
"begin": "\\b(?<=%)([Oo][Pp][Tt][Ii][Oo][Nn][Ss])", | ||
"end": "$\\n?", | ||
"beginCaptures": { | ||
"1": { | ||
"name": "keyword.control.less.jikespg" | ||
} | ||
}, | ||
"patterns": [ | ||
{ | ||
"match": "([^=,]+)(?:=([^,]+))?", | ||
"captures": { | ||
"1": { | ||
"name": "variable.name.jikespg" | ||
}, | ||
"2": { | ||
"name": "constant.language.jikespg" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"sections": { | ||
"begin": "\\b(?<=\\$)([Tt][Ee][Rr][Mm][Ii][Nn][Aa][Ll][Ss])\\b", | ||
"end": "(?=\\$)", | ||
"beginCaptures": { | ||
"1": { | ||
"name": "keyword.control" | ||
} | ||
}, | ||
"patterns": [ | ||
{ | ||
"name": "constant.language", | ||
"match": "\\b(\\w+)\\b" | ||
}, | ||
{ | ||
"include": "#comments" | ||
} | ||
] | ||
}, | ||
"embeddedCode": { | ||
"patterns": [ | ||
{ | ||
"name": "string.quoted.triple.jikespg", | ||
"begin": "\\s*/\\.", | ||
"end": "\\./" | ||
}, | ||
{ | ||
"name": "string.quoted.triple.jikespg", | ||
"begin": "\\s*/:", | ||
"end": ":/" | ||
} | ||
] | ||
}, | ||
"macro": { | ||
"patterns": [ | ||
{ | ||
"match": "\\b(?<=\\$)(\\w+)\\b", | ||
"name": "entity.name.function" | ||
} | ||
] | ||
}, | ||
"productions": { | ||
"patterns": [ | ||
{ | ||
"name": "variable.name.jikespg", | ||
"begin": "^\\s*([%\\{\\}\\[\\]\\w]+)\\s*(::=)", | ||
"end": "(?:(?=--)|$\\n?)", | ||
"beginCaptures": { | ||
"1": { | ||
"name": "variable.name.jikespg" | ||
}, | ||
"2": { | ||
"name": "keyword.operator.jikespg" | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "variable.name.jikespg", | ||
"begin": "^\\s*([%\\{\\}\\[\\]\\w]+)\\s*(->)", | ||
"end": "(?:(?=--)|$\\n?)", | ||
"beginCaptures": { | ||
"1": { | ||
"name": "variable.name.jikespg" | ||
}, | ||
"2": { | ||
"name": "keyword.operator.jikespg" | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "variable.name.jikespg", | ||
"begin": "^\\s*(\\|)", | ||
"end": "(?:(?=--)|$\\n?)", | ||
"beginCaptures": { | ||
"1": { | ||
"name": "keyword.operator.jikespg" | ||
} | ||
} | ||
}, | ||
{ | ||
"comment": "if not yet captured, it's probably a continued definition line. use hard symbols to avoid reparsing something", | ||
"begin": "^", | ||
"end": "(?:(?:/.)|(?:\\$)|(?=--)|$\\n?)", | ||
"patterns": [ | ||
{ | ||
"name": "variable.name.jikespg", | ||
"match": "([%\\{\\}\\[\\]\\w]+)" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"scopeName": "lngpck.source.jikespg" | ||
} |
25 changes: 25 additions & 0 deletions
25
org.eclipse.tm4e.language_pack/jikespg/language-configuration.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"comments": { | ||
"lineComment": "--" | ||
}, | ||
"brackets": [ | ||
["/.", "./"], | ||
["{", "}"], | ||
["[", "]"], | ||
["(", ")"] | ||
], | ||
"autoClosingPairs": [ | ||
["{", "}"], | ||
["[", "]"], | ||
["(", ")"], | ||
["\"", "\""], | ||
["'", "'"] | ||
], | ||
"surroundingPairs": [ | ||
["{", "}"], | ||
["[", "]"], | ||
["(", ")"], | ||
["\"", "\""], | ||
["'", "'"] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters