Commit db4f69e2 authored by jayherron's avatar jayherron

Adding more highlighting rules for axon keywords and numbers.

parent 1e2b090c
[
{
"id": 1,
"nm": "Edward the Elder",
"cty": "United Kingdom",
"hse": "House of Wessex",
"yrs": "899-925"
},
{
"id": 2,
"nm": "Athelstan",
"cty": "United Kingdom",
"hse": "House of Wessex",
"yrs": "925-940"
},
{
"id": 3,
"nm": "Edmund",
"cty": "United Kingdom",
"hse": "House of Wessex",
"yrs": "940-946"
},
{
"id": 4,
"nm": "Edred",
"cty": "United Kingdom",
"hse": "House of Wessex",
"yrs": "946-955"
},
{
"id": 5,
"nm": "Edwy",
"cty": "United Kingdom",
"hse": "House of Wessex",
"yrs": "955-959"
},
{
"id": 6,
"nm": "Edgar",
"cty": "United Kingdom",
"hse": "House of Wessex",
"yrs": "959-975"
},
{
"id": 7,
"nm": "Edward the Martyr",
"cty": "United Kingdom",
"hse": "House of Wessex",
"yrs": "975-978"
},
{
"id": 8,
"nm": "Ethelred II the Unready",
"cty": "United Kingdom",
"hse": "House of Wessex",
"yrs": "978-1016"
},
{
"id": 9,
"nm": "Edmund lronside",
"cty": "United Kingdom",
"hse": "House of Wessex",
"yrs": "1016"
},
{
"id": 10,
"nm": "Cnut",
"cty": "United Kingdom",
"hse": "House of Denmark",
"yrs": "1016-1035"
},
{
"id": 11,
"nm": "Harold I Harefoot",
"cty": "United Kingdom",
"hse": "House of Denmark",
"yrs": "1035-1040"
},
{
"id": 12,
"nm": "Harthacanut",
"cty": "United Kingdom",
"hse": "House of Denmark",
"yrs": "1040-1042"
},
{
"id": 13,
"nm": "Edward the Confessor",
"cty": "United Kingdom",
"hse": "House of Wessex",
"yrs": "1042-1066"
},
{
"id": 14,
"nm": "Harold II",
"cty": "United Kingdom",
"hse": "House of Wessex",
"yrs": "1066"
},
{
"id": 15,
"nm": "William I",
"cty": "United Kingdom",
"hse": "House of Normandy",
"yrs": "1066-1087"
},
{
"id": 16,
"nm": "William II",
"cty": "United Kingdom",
"hse": "House of Normandy",
"yrs": "1087-1100"
},
{
"id": 17,
"nm": "Henry I",
"cty": "United Kingdom",
"hse": "House of Normandy",
"yrs": "1100-1135"
},
{
"id": 18,
"nm": "Stephen",
"cty": "United Kingdom",
"hse": "House of Blois",
"yrs": "1135-1154"
},
{
"id": 19,
"nm": "Henry II",
"cty": "United Kingdom",
"hse": "House of Angevin",
"yrs": "1154-1189"
},
{
"id": 20,
"nm": "Richard I",
"cty": "United Kingdom",
"hse": "House of Angevin",
"yrs": "1189-1199"
},
{
"id": 21,
"nm": "John",
"cty": "United Kingdom",
"hse": "House of Angevin",
"yrs": "1199-1216"
},
{
"id": 22,
"nm": "Henry III",
"cty": "United Kingdom",
"hse": "House of Plantagenet",
"yrs": "1216-1272"
},
{
"id": 23,
"nm": "Edward I",
"cty": "United Kingdom",
"hse": "House of Plantagenet",
"yrs": "1272-1307"
},
{
"id": 24,
"nm": "Edward II",
"cty": "United Kingdom",
"hse": "House of Plantagenet",
"yrs": "1307-1327"
},
{
"id": 25,
"nm": "Edward III",
"cty": "United Kingdom",
"hse": "House of Plantagenet",
"yrs": "1327-1377"
},
{
"id": 26,
"nm": "Richard II",
"cty": "United Kingdom",
"hse": "House of Plantagenet",
"yrs": "1377-1399"
},
{
"id": 27,
"nm": "Henry IV",
"cty": "United Kingdom",
"hse": "House of Lancaster",
"yrs": "1399-1413"
},
{
"id": 28,
"nm": "Henry V",
"cty": "United Kingdom",
"hse": "House of Lancaster",
"yrs": "1413-1422"
},
{
"id": 29,
"nm": "Henry VI",
"cty": "United Kingdom",
"hse": "House of Lancaster",
"yrs": "1422-1461"
},
{
"id": 30,
"nm": "Edward IV",
"cty": "United Kingdom",
"hse": "House of York",
"yrs": "1461-1483"
},
{
"id": 31,
"nm": "Edward V",
"cty": "United Kingdom",
"hse": "House of York",
"yrs": "1483"
},
{
"id": 32,
"nm": "Richard III",
"cty": "United Kingdom",
"hse": "House of York",
"yrs": "1483-1485"
},
{
"id": 33,
"nm": "Henry VII",
"cty": "United Kingdom",
"hse": "House of Tudor",
"yrs": "1485-1509"
},
{
"id": 34,
"nm": "Henry VIII",
"cty": "United Kingdom",
"hse": "House of Tudor",
"yrs": "1509-1547"
},
{
"id": 35,
"nm": "Edward VI",
"cty": "United Kingdom",
"hse": "House of Tudor",
"yrs": "1547-1553"
},
{
"id": 36,
"nm": "Mary I",
"cty": "United Kingdom",
"hse": "House of Tudor",
"yrs": "1553-1558"
},
{
"id": 37,
"nm": "Elizabeth I",
"cty": "United Kingdom",
"hse": "House of Tudor",
"yrs": "1558-1603"
},
{
"id": 38,
"nm": "James I",
"cty": "United Kingdom",
"hse": "House of Stuart",
"yrs": "1603-1625"
},
{
"id": 39,
"nm": "Charles I",
"cty": "United Kingdom",
"hse": "House of Stuart",
"yrs": "1625-1649"
},
{
"id": 40,
"nm": "Commonwealth",
"cty": "United Kingdom",
"hse": "Commonwealth",
"yrs": "1649-1653"
},
{
"id": 41,
"nm": "Oliver Cromwell",
"cty": "United Kingdom",
"hse": "Commonwealth",
"yrs": "1653-1658"
},
{
"id": 42,
"nm": "Richard Cromwell",
"cty": "United Kingdom",
"hse": "Commonwealth",
"yrs": "1658-1659"
},
{
"id": 43,
"nm": "Charles II",
"cty": "United Kingdom",
"hse": "House of Stuart",
"yrs": "1660-1685"
},
{
"id": 44,
"nm": "James II",
"cty": "United Kingdom",
"hse": "House of Stuart",
"yrs": "1685-1688"
},
{
"id": 45,
"nm": "William III",
"cty": "United Kingdom",
"hse": "House of Orange",
"yrs": "1689-1694"
},
{
"id": 46,
"nm": "Anne",
"cty": "United Kingdom",
"hse": "House of Stuart",
"yrs": "1702-1714"
},
{
"id": 47,
"nm": "George I",
"cty": "United Kingdom",
"hse": "House of Hanover",
"yrs": "1714-1727"
},
{
"id": 48,
"nm": "George II",
"cty": "United Kingdom",
"hse": "House of Hanover",
"yrs": "1727-1760"
},
{
"id": 49,
"nm": "George III",
"cty": "United Kingdom",
"hse": "House of Hanover",
"yrs": "1760-1820"
},
{
"id": 50,
"nm": "George IV",
"cty": "United Kingdom",
"hse": "House of Hanover",
"yrs": "1820-1830"
},
{
"id": 51,
"nm": "William IV",
"cty": "United Kingdom",
"hse": "House of Hanover",
"yrs": "1830-1837"
},
{
"id": 52,
"nm": "Victoria",
"cty": "United Kingdom",
"hse": "House of Hanover",
"yrs": "1837-1901"
},
{
"id": 53,
"nm": "Edward VII",
"cty": "United Kingdom",
"hse": "House of Saxe-Coburg-Gotha",
"yrs": "1901-1910"
},
{
"id": 54,
"nm": "George V",
"cty": "United Kingdom",
"hse": "House of Windsor",
"yrs": "1910-1936"
},
{
"id": 55,
"nm": "Edward VIII",
"cty": "United Kingdom",
"hse": "House of Windsor",
"yrs": "1936"
},
{
"id": 56,
"nm": "George VI",
"cty": "United Kingdom",
"hse": "House of Windsor",
"yrs": "1936-1952"
},
{
"id": 57,
"nm": "Elizabeth II",
"cty": "United Kingdom",
"hse": "House of Windsor",
"yrs": "1952-"
}
]
\ No newline at end of file
/*
Multi-line comment
*/
// This is another comment
dis: "Site 1"
site
area: 3702ft²
geoAddr: "100 Main St, Richmond, VA"
geoCoord: C(37.5458,-77.4491)
strTag: OK if unquoted if only safe chars
summary:
This is a string value which spans multiple
lines with two or more space characters
---
name: "Site 2"
site
summary:
Entities are separated by one more dashes
---
type:list
val:[1,2,3]
---
type:dict
val:{ dis:"Dict!" foo}
---
type:grid
val:Zinc:
ver:"3.0"
b,a
20,10
---
name: "helloWorld"
site
src:
() => do
return "hello world"
end
\ No newline at end of file
<?xml version="1.0" encoding="ISO8859-1" ?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
......@@ -6,6 +6,8 @@ public interface ITrioColorConstants {
RGB COMMENT = new RGB(128, 0, 0);
RGB COORDINATE = new RGB(0, 128, 128);
RGB DEFAULT = new RGB(0, 0, 0);
RGB KEYWORD = new RGB(128, 128, 0);
RGB NUMBER = new RGB(128, 0, 128);
RGB PROC_INSTR = new RGB(128, 128, 128);
RGB STRING = new RGB(0, 128, 0);
RGB TAG = new RGB(0, 0, 128);
......
package trioeditor.editors;
import org.eclipse.jface.text.rules.*;
public class KeywordRule extends WordRule {
public KeywordRule() {
super(new IWordDetector() { // This "word detector" is basically any acceptable java identifier.
@Override
public boolean isWordStart(char c) {
return c != ' ' && Character.isJavaIdentifierStart(c);
}
@Override
public boolean isWordPart(char c) {
return Character.isJavaIdentifierPart(c);
}
});
}
}
......@@ -14,23 +14,42 @@ public class TrioScanner extends RuleBasedScanner {
IToken comment = new Token(new TextAttribute(manager.getColor(ITrioColorConstants.COMMENT)));
IToken string = new Token(new TextAttribute(manager.getColor(ITrioColorConstants.STRING)));
IToken coordinate = new Token(new TextAttribute(manager.getColor(ITrioColorConstants.COORDINATE)));
IToken number = new Token(new TextAttribute(manager.getColor(ITrioColorConstants.NUMBER)));
IToken keyword = new Token(new TextAttribute(manager.getColor(ITrioColorConstants.KEYWORD)));
IRule[] rules = new IRule[5];
IRule[] rules = new IRule[7];
// Multi-line rules
// Comment
rules[0] = new MultiLineRule("/*", "*/", comment);
// Single-line rules
// End-of-line rules
// Comment
rules[1] = new SingleLineRule("//", "", comment);
rules[1] = new EndOfLineRule("//", comment);
// Single-line rules
// String
rules[2] = new SingleLineRule("\"", "\"", string);
// Coordinates
rules[3] = new SingleLineRule("C(", ")", coordinate);
// Coordinates
rules[4] = new NumberRule(number);
// Add generic whitespace rule.
rules[4] = new WhitespaceRule(new TrioWhitespaceDetector());
rules[5] = new WhitespaceRule(new TrioWhitespaceDetector());
// Keywords
final KeywordRule keywords = new KeywordRule();
// Axon keywords
keywords.addWord("null", keyword);
keywords.addWord("do", keyword);
keywords.addWord("end", keyword);
keywords.addWord("return", keyword);
keywords.addWord("true", keyword);
keywords.addWord("false", keyword);
rules[6] = keywords;
setRules(rules);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment