+// Copyright 2006 all rights reserved; see LICENSE file for BSD-style license
+
package edu.berkeley.sbp.meta;
import edu.berkeley.sbp.util.*;
import edu.berkeley.sbp.*;
Seq[] group = sequences[i];
Union u2 = new Union(null, false);
if (sequences.length==1) u2 = u;
- for(int j=0; j<group.length; j++) {
+ for(int j=0; j<group.length; j++)
group[j].build(cx, u2, cnt);
- }
if (sequences.length==1) break;
Sequence seq = Sequence.create(u2);
for(Sequence s : bad2) seq = seq.andnot(s);
public static @bind.as("Elements") Seq seq2(ElementNode[] elements) { return new Seq(elements); }
public static @bind.as Seq psx(Seq s) { return s; }
public static @bind.as(":") ElementNode colon(String s, ElementNode e) { return new Label(s, e); }
+ public static @bind.as("{") ElementNode leftBrace() {
+ return new Drop(new CharClass(new Range[] { new Range(CharAtom.left, CharAtom.left) })); }
+ public static @bind.as("}") ElementNode rightBrace() {
+ return new Drop(new CharClass(new Range[] { new Range(CharAtom.right, CharAtom.right) })); }
public static @bind.as(")") void close(String foo) { throw new Error("not supported"); }
public static @bind.as("()") ElementNode epsilon() { return new Constant(epsilon); }
public static @bind.as("~") ElementNode tilde(final ElementNode e) {
return new ElementNodeWrapper(e) {
public Atom toAtom(Context cx) {
- return infer((Topology<Character>)e.toAtom(cx).complement().minus(CharAtom.braces));
+ return infer((Topology<Character>)e.toAtom(cx).complement()/*.minus(CharAtom.braces)*/);
}
public Element build(Context cx, NonTerminalNode cnt) {
- return infer((Topology<Character>)e.toAtom(cx).complement().minus(CharAtom.braces));
+ return infer((Topology<Character>)e.toAtom(cx).complement()/*.minus(CharAtom.braces)*/);
} }; }
public static @bind.as("Word") String word(String s) { return s; }
public static @bind.as("Quoted") String quoted(String s) { return s; }
- public static @bind.as("escaped") String c(char c) { return c+""; }
+ public static @bind.as("escaped") String c(char c) {
+ if (c=='{') return CharAtom.left+"";
+ if (c=='}') return CharAtom.right+"";
+ return c+"";
+ }
public static @bind.as("EmptyString") String emptystring() { return ""; }
public static @bind.as("\n") String retur() { return "\n"; }
public static @bind.as("\r") String lf() { return "\r"; }