mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-12 06:15:32 -04:00
expression parser supports a backslash in a variables name; see #581
This commit is contained in:
parent
d03cc1c492
commit
dbce369808
@ -17,9 +17,9 @@ public class Tokenizer {
|
||||
enum Token {UNKNOWN, IDENT, AND, OR, NOT, XOR, OPEN, CLOSE, ONE, ZERO, EOF, COMMA, EQUAL, NOTEQUAL, POSTNOT}
|
||||
|
||||
private final Reader in;
|
||||
private final StringBuilder builder;
|
||||
private Token token;
|
||||
private boolean isToken;
|
||||
private StringBuilder builder;
|
||||
private boolean isUnreadChar = false;
|
||||
private int unreadChar;
|
||||
|
||||
@ -174,7 +174,7 @@ public class Tokenizer {
|
||||
private boolean isIdentChar(int c) {
|
||||
return (c >= 'a' && c <= 'z')
|
||||
|| (c >= 'A' && c <= 'Z')
|
||||
|| (c == '_');
|
||||
|| (c == '_') || (c == '\\');
|
||||
}
|
||||
|
||||
private boolean isNumberChar(int c) {
|
||||
|
@ -27,6 +27,7 @@ public class ParserTest extends TestCase {
|
||||
public void testIdent() throws Exception {
|
||||
assertEquals(new Variable("C"), createSingle("C"));
|
||||
assertEquals(new Variable("A_1"), createSingle("A_1"));
|
||||
assertEquals(new Variable("A\\_1"), createSingle("A\\_1"));
|
||||
}
|
||||
|
||||
public void testConst() throws Exception {
|
||||
|
Loading…
x
Reference in New Issue
Block a user