}
if (c == String.class) {
boolean ok = true;
- for(int i=0; i<a.length; i++) if (a[i]==null || !(a[i] instanceof Character)) ok = false;
+ for(int i=0; i<a.length; i++)
+ if (a[i]==null || (!(a[i] instanceof Character) && !(a[i] instanceof String)))
+ ok = false;
if (ok) {
StringBuffer s = new StringBuffer();
- for(int i=0; i<a.length; i++) s.append((((Character)a[i])).charValue());
+ for(int i=0; i<a.length; i++)
+ s.append(a[i] instanceof Character
+ ? (((Character)a[i]).charValue())+""
+ : (String)a[i]
+ );
return s.toString();
}
}
s ::= ws grammar ws => "gram"
ws !::= w**
-grammar ::= r +/ ws => "grammar"
+grammar ::= r +/ ws => "grammar"
r ::= word ^"::=" alternatives /ws
| word ^"!::=" alternatives /ws
alternatives ::= equiAlt +/ (ws ">" ws)
-equiAlt ::= conjuncts +/ (ws "|" ws) => "alternatives"
+equiAlt ::= conjuncts +/ (ws "|" ws) => "alternatives"
sequence ::= es
> es ws ^"/" e
| ec ^"-" ec
e ::= word => "nonTerminalY"
- | [(][)] => "epsilon"
+ | [(][)] => "epsilon"
| ^"{" alternatives "}" /ws
| ^"[" (range*) "]"
| ^"[~" (range*) "]"
- | e ^"+/" e /ws
- | e ^"*/" e /ws
- | e ^"?" /ws
+ | ^"^" quoted /ws
| e ^"~/~" /ws
-
- | e ^"-" e /ws
-
| ^"!" e /ws
- | ^"^" quoted /ws
+
| ^"`" e /ws
| e ^"#" /ws
- | quoted => "literal"
| (e ws ^"**" > e ws ^"*")
+ | e ^"*/" e /ws
| (e ws ^"++" > e ws ^"+")
+ | e ^"+/" e /ws
+ | e ^"?" /ws
+
+ | quoted => "literal"
| "(" word ^")" /ws
> ^"(" alternatives ")" /ws
| "\n"
| "\r"
an ::= [a-zA-Z0-9_]
-word ::= an++ => "sify"
+word ::= an++
quoted ::= "\"" (([~\"\\] | escaped)*) "\"" => "sify"
escaped ::= "\\n" => "\n"
| "\\r" => "\r"