-// Copyright 2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
+// Copyright 2006 all rights reserved; see LICENSE file for BSD-style license
- public Character next(int numstates, int resets, int waits) throws IOException {
- Character ret = nextc(numstates, resets);
+ public Character next() throws IOException {
+ Character ret = nextc();
if (ret==null) return null;
else if (ret==left) System.out.print("\033[31m{\033[0m");
else if (ret==right) System.out.print("\033[31m}\033[0m");
if (ret==null) return null;
else if (ret==left) System.out.print("\033[31m{\033[0m");
else if (ret==right) System.out.print("\033[31m}\033[0m");
- private final Element ws = Repeat.maximal0(getNonTerminal("w"));
- public Grammar() { dropAll.add(ws); }
+ private final Element ws = Sequence.maximal0(getNonTerminal("w"));
+ public Grammar(Class c) { super(c); dropAll.add(ws); }
public Object walk(Tree<String> tree) {
String head = tree.head();
if (tree.numChildren()==0) return super.walk(tree);
public Object walk(Tree<String> tree) {
String head = tree.head();
if (tree.numChildren()==0) return super.walk(tree);
Union u = new Union("???");
Union u2 = ((PreSequence)walk(tree, 0)).sparse(ws).buildUnion();
u2.add(Sequence.singleton(new Element[] { u }, 0));
Union u = new Union("???");
Union u2 = ((PreSequence)walk(tree, 0)).sparse(ws).buildUnion();
u2.add(Sequence.singleton(new Element[] { u }, 0));
- return anonymousNonTerminal(new PreSequence[][] {
- new PreSequence[] {
- new PreSequence(new Element[] { CharRange.leftBrace,
- ws,
- u2,
- ws,
- CharRange.rightBrace
- })
+ return anonymousNonTerminal(new Sequence[][] {
+ new Sequence[] {
+ Sequence.singleton(new Element[] { CharAtom.leftBrace,
+ ws,
+ u2,
+ ws,
+ CharAtom.rightBrace
+ }, 2)