Skip to content

Commit

Permalink
cleared up the way grammars can be created. Now all we need is for so…
Browse files Browse the repository at this point in the history
…meone to initialize them in an orderly way.
  • Loading branch information
Silvio Heuberger committed Sep 5, 2009
1 parent 8e69541 commit 8919b0a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
3 changes: 1 addition & 2 deletions bench/com/redcareditor/mate/GrammarBenchmark.java
Expand Up @@ -28,8 +28,7 @@ public void setupForAll() {
singlePatterns = new ArrayList<SinglePattern>();
readFile();

Dict d = Dict.parseFile("input/Ruby.plist");
grammar = new Grammar(d);
grammar = new Grammar("input/Ruby.plist");
grammar.initForUse();

for (Pattern p : grammar.allPatterns) {
Expand Down
2 changes: 1 addition & 1 deletion src/com/redcareditor/mate/Bundle.java
Expand Up @@ -75,7 +75,7 @@ private static void loadGrammar(Bundle bundle, File syntaxDir) {
for (String grammarFileName : syntaxDir.list()) {
if (isTmBundlefile(grammarFileName)) {
String grammarFilePath = syntaxDir.getPath() + "/" + grammarFileName;
Grammar grammar = new Grammar(grammarFileName, grammarFilePath);
Grammar grammar = new Grammar(grammarFilePath);
bundle.getGrammars().add(grammar);
}
}
Expand Down
10 changes: 3 additions & 7 deletions src/com/redcareditor/mate/Grammar.java
Expand Up @@ -31,14 +31,10 @@ public class Grammar {
/* these are here for lookup speed purposes */
private static Map<String, Grammar> grammarsByScopeNames = new HashMap<String, Grammar>();

public Grammar(String name, String plistFile){
this(Dict.parseFile(plistFile));
this.name = name;
}

public Grammar(Dict plist) {
public Grammar(String plistFile){
this.plist = Dict.parseFile(plistFile);
propertyLoader = new PlistPropertyLoader(plist, this);
this.plist = plist;
initForReference();
}

public void initForReference() {
Expand Down
3 changes: 1 addition & 2 deletions test/com/redcareditor/mate/GrammarTest.java
Expand Up @@ -15,8 +15,7 @@ public class GrammarTest {

@Before
public void setUp() {
ruby = Dict.parseFile("input/Bundles/Apache.tmbundle/Syntaxes/Apache.plist");
g = new Grammar(ruby);
g = new Grammar("input/Bundles/Apache.tmbundle/Syntaxes/Apache.plist");
g.initForUse();
}

Expand Down

0 comments on commit 8919b0a

Please sign in to comment.