@Test public void testCanParseSemicolonWithinCommand() throws Exception { final ParserBuffer reader = reader("sp {test (state <s> ^superstate nil;) --> (<s> ^test true)};"); assertEquals(Arrays.asList("sp", "test (state <s> ^superstate nil;) --> (<s> ^test true)"), parser.parseCommand(reader).getArgs()); checkRemainder("", reader); }
public ParsedCommand parseCommand(ParserBuffer reader) throws IOException, SoarException { startOfCommand = -1; lineOfCommand = -1; final List<String> result = new ArrayList<String>(); skipWhitespaceAndComments(reader); if(!atEndOfCommand(reader)) { String word = parseWord(reader); while(word != null) { result.add(word); if(atEndOfCommand(reader)) { break; } skipWhitespaceAndComments(reader); word = parseWord(reader); } } final SourceLocation loc = DefaultSourceLocation.newBuilder(). file(reader.getFile()). offset(startOfCommand). length(reader.getCurrentOffset() - startOfCommand). line(lineOfCommand). build(); return new ParsedCommand(loc, result); }
DefaultInterpreterParser { public ParsedCommand parseCommand(ParserBuffer reader) throws IOException, SoarException { startOfCommand = -1; lineOfCommand = -1; final List<String> result = new ArrayList<String>(); skipWhitespaceAndComments(reader); if(!atEndOfCommand(reader)) { String word = parseWord(reader); while(word != null) { result.add(word); if(atEndOfCommand(reader)) { break; } skipWhitespaceAndComments(reader); word = parseWord(reader); } } final SourceLocation loc = DefaultSourceLocation.newBuilder(). file(reader.getFile()). offset(startOfCommand). length(reader.getCurrentOffset() - startOfCommand). line(lineOfCommand). build(); return new ParsedCommand(loc, result); } }
DefaultInterpreterParser { public ParsedCommand parseCommand(ParserBuffer reader) throws IOException, SoarException { startOfCommand = -1; lineOfCommand = -1; final List<String> result = new ArrayList<String>(); skipWhitespaceAndComments(reader); if(!atEndOfCommand(reader)) { String word = parseWord(reader); while(word != null) { result.add(word); if(atEndOfCommand(reader)) { break; } skipWhitespaceAndComments(reader); word = parseWord(reader); } } final SourceLocation loc = DefaultSourceLocation.newBuilder(). file(reader.getFile()). offset(startOfCommand). length(reader.getCurrentOffset() - startOfCommand). line(lineOfCommand). build(); return new ParsedCommand(loc, result); }  }
DefaultInterpreterParser { public ParsedCommand parseCommand(ParserBuffer reader) throws IOException, SoarException { startOfCommand = -1; lineOfCommand = -1; final List<String> result = new ArrayList<String>(); skipWhitespaceAndComments(reader); if(!atEndOfCommand(reader)) { String word = parseWord(reader); while(word != null) { result.add(word); if(atEndOfCommand(reader)) { break; } skipWhitespaceAndComments(reader); word = parseWord(reader); } } final SourceLocation loc = DefaultSourceLocation.newBuilder(). file(reader.getFile()). offset(startOfCommand). length(reader.getCurrentOffset() - startOfCommand). line(lineOfCommand). build(); return new ParsedCommand(loc, result); }  ParsedCommand parseCommand(ParserBuffer reader); void skipWhitespace(ParserBuffer reader); void skipWhitespaceAndComments(ParserBuffer reader); String parseWord(ParserBuffer reader); }
DefaultInterpreterParser { public ParsedCommand parseCommand(ParserBuffer reader) throws IOException, SoarException { startOfCommand = -1; lineOfCommand = -1; final List<String> result = new ArrayList<String>(); skipWhitespaceAndComments(reader); if(!atEndOfCommand(reader)) { String word = parseWord(reader); while(word != null) { result.add(word); if(atEndOfCommand(reader)) { break; } skipWhitespaceAndComments(reader); word = parseWord(reader); } } final SourceLocation loc = DefaultSourceLocation.newBuilder(). file(reader.getFile()). offset(startOfCommand). length(reader.getCurrentOffset() - startOfCommand). line(lineOfCommand). build(); return new ParsedCommand(loc, result); }  ParsedCommand parseCommand(ParserBuffer reader); void skipWhitespace(ParserBuffer reader); void skipWhitespaceAndComments(ParserBuffer reader); String parseWord(ParserBuffer reader);  }