]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/parser/grammar/Production.java
Moved SCL parser generator to platform repository.
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / parser / grammar / Production.java
1 package org.simantics.scl.compiler.parser.grammar;
2
3 import org.simantics.scl.compiler.parser.regexp.Regexp;
4
5 import gnu.trove.map.hash.TIntByteHashMap;
6
7 public class Production {
8     public final String name;
9     public int lhs;
10     public final Regexp rhs;
11     public final TIntByteHashMap annotations;
12     
13     public Production(String name, int lhs, Regexp rhs,
14             TIntByteHashMap annotations) {
15         this.name = name;
16         this.lhs = lhs;
17         this.rhs = rhs;
18         this.annotations = annotations;
19     }
20
21     public String toString(Grammar grammar) {
22         StringBuilder b = new StringBuilder();
23         b.append(grammar.getName(lhs));
24         b.append(" = ");
25         rhs.toString(b, grammar, 0);
26         return b.toString();
27     }
28 }