Fixed quoting in parser
This commit is contained in:
parent
11e9a5805e
commit
15c48def68
|
|
@ -18,7 +18,7 @@ public class Example6 extends Example {
|
|||
|
||||
private void test() throws MikrotikApiException, InterruptedException {
|
||||
System.out.println("Creating interface gre1");
|
||||
con.execute("/interface/gre/add remote-address=1.2.3.4 name=gre1 keepalive=10 comment=\"test comment\"");
|
||||
con.execute("/interface/gre/add remote-address=1.2.3.4 name=gre1 keepalive=10 comment='test comment'");
|
||||
System.out.println("Adding firewall rule for interface gre1");
|
||||
con.execute("/ip/firewall/filter/add action=drop chain=forward in-interface=gre1 protocol=udp dst-port=78,80");//,80,32");
|
||||
System.out.println("Waiting 10 seconds");
|
||||
|
|
|
|||
|
|
@ -74,7 +74,9 @@ class Scanner {
|
|||
nextChar();
|
||||
return Token.EQUALS;
|
||||
case '"' :
|
||||
return quotedText();
|
||||
return quotedText('"');
|
||||
case '\'' :
|
||||
return quotedText('\'');
|
||||
default :
|
||||
return name();
|
||||
}
|
||||
|
|
@ -109,10 +111,10 @@ class Scanner {
|
|||
}
|
||||
|
||||
/** process quoted text */
|
||||
private Token quotedText() throws ScanException {
|
||||
private Token quotedText(char quote) throws ScanException {
|
||||
nextChar(); // eat the '"'
|
||||
text = new StringBuilder();
|
||||
while (c != '"') {
|
||||
while (c != quote) {
|
||||
if (c == '\n') {
|
||||
throw new ScanException("Unclosed quoted text, reached end of line.");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue