ABLLexer implements TokenSource, IPreprocessor { @Override public Token nextToken() { return wrapper.nextToken(); } ABLLexer(IProparseEnvironment session, ByteSource src, String fileName, boolean lexOnly); protected  ABLLexer(IProparseEnvironment session, ByteSource src, String fileName); String getMainFileName(); IntegerIndex<String> getFilenameList(); String getFilename(int fileIndex); void enableWritableTokens(); @Override Token nextToken(); @Override int getLine(); @Override int getCharPositionInLine(); @Override CharStream getInputStream(); @Override String getSourceName(); @Override void setTokenFactory(TokenFactory<?> factory); @Override TokenFactory<?> getTokenFactory(); void parseComplete(); boolean isConsuming(); boolean isConsumingFromOuterIf(); void incrementConsuming(); void decrementConsuming(); IPreprocessorEventListener getLstListener(); IProparseEnvironment getRefactorSession(); JPNodeMetrics getMetrics(); IncludeRef getMacroGraph(); IProparseSettings getProparseSettings(); boolean isAppBuilderCode(); @Override String defined(String argName); @Override void defGlobal(String argName, String argVal); @Override void defScoped(String argName, String argVal); @Override String getArgText(int argNum); @Override String getArgText(String argName); @Override void undef(String argName); @Override void analyzeSuspend(String analyzeSuspend); @Override void analyzeResume();  }
@Test public void testEndOfFile() { final String source = "CURRENT-WINDOW:HANDLE. SESSION:FIRST-SERVER-SOCKET:HANDLE. TEMP-TABLE tt1::fld1. DATASET ds1::tt1. DATASET ds1::tt1:set-callback()."; ABLLexer lexer = new ABLLexer(session, ByteSource.wrap(source.getBytes()), "file.txt", true); while (lexer.nextToken().getType() != Token.EOF) { } for (int zz = 0; zz < 1000; zz++) { lexer.nextToken(); } assertEquals(lexer.nextToken().getType(), Token.EOF); assertEquals(lexer.nextToken().getType(), Token.EOF); }
@Test public void testSomeKeywords01() { final String source = "CURRENT-WINDOW:HANDLE. SESSION:FIRST-SERVER-SOCKET:HANDLE. TEMP-TABLE tt1::fld1. DATASET ds1::tt1. DATASET ds1::tt1:set-callback()."; ABLLexer lexer = new ABLLexer(session, ByteSource.wrap(source.getBytes()), "file.txt"); assertEquals(lexer.nextToken().getType(), Proparse.CURRENTWINDOW); assertEquals(lexer.nextToken().getType(), Proparse.OBJCOLON); assertEquals(lexer.nextToken().getType(), Proparse.HANDLE); assertEquals(lexer.nextToken().getType(), Proparse.PERIOD); assertEquals(lexer.nextToken().getType(), Proparse.WS); assertEquals(lexer.nextToken().getType(), Proparse.SESSION); assertEquals(lexer.nextToken().getType(), Proparse.OBJCOLON); assertEquals(lexer.nextToken().getType(), Proparse.ID); assertEquals(lexer.nextToken().getType(), Proparse.OBJCOLON); assertEquals(lexer.nextToken().getType(), Proparse.HANDLE); assertEquals(lexer.nextToken().getType(), Proparse.PERIOD); assertEquals(lexer.nextToken().getType(), Proparse.WS); assertEquals(lexer.nextToken().getType(), Proparse.TEMPTABLE); assertEquals(lexer.nextToken().getType(), Proparse.WS); assertEquals(lexer.nextToken().getType(), Proparse.ID); assertEquals(lexer.nextToken().getType(), Proparse.DOUBLECOLON); assertEquals(lexer.nextToken().getType(), Proparse.ID); assertEquals(lexer.nextToken().getType(), Proparse.PERIOD); assertEquals(lexer.nextToken().getType(), Proparse.WS); assertEquals(lexer.nextToken().getType(), Proparse.DATASET); assertEquals(lexer.nextToken().getType(), Proparse.WS); assertEquals(lexer.nextToken().getType(), Proparse.ID); assertEquals(lexer.nextToken().getType(), Proparse.DOUBLECOLON); assertEquals(lexer.nextToken().getType(), Proparse.ID); assertEquals(lexer.nextToken().getType(), Proparse.PERIOD); assertEquals(lexer.nextToken().getType(), Proparse.WS); assertEquals(lexer.nextToken().getType(), Proparse.DATASET); assertEquals(lexer.nextToken().getType(), Proparse.WS); assertEquals(lexer.nextToken().getType(), Proparse.ID); assertEquals(lexer.nextToken().getType(), Proparse.DOUBLECOLON); assertEquals(lexer.nextToken().getType(), Proparse.ID); assertEquals(lexer.nextToken().getType(), Proparse.OBJCOLON); assertEquals(lexer.nextToken().getType(), Proparse.ID); assertEquals(lexer.nextToken().getType(), Proparse.LEFTPAREN); assertEquals(lexer.nextToken().getType(), Proparse.RIGHTPAREN); assertEquals(lexer.nextToken().getType(), Proparse.PERIOD); }
@Test public void testAbbrevKeywords() { ABLLexer lexer = new ABLLexer(session, ByteSource.wrap("LC('HELLO').".getBytes()), "file.txt"); ProToken tok = (ProToken) lexer.nextToken(); assertFalse(tok.isAbbreviated()); lexer = new ABLLexer(session, ByteSource.wrap("LOWER('WORLD').".getBytes()), "file.txt"); tok = (ProToken) lexer.nextToken(); assertFalse(tok.isAbbreviated()); lexer = new ABLLexer(session, ByteSource.wrap("FILE-INFO.".getBytes()), "file.txt"); tok = (ProToken) lexer.nextToken(); assertTrue(tok.isAbbreviated()); lexer = new ABLLexer(session, ByteSource.wrap("FILE-INFORMATION.".getBytes()), "file.txt"); tok = (ProToken) lexer.nextToken(); assertFalse(tok.isAbbreviated()); lexer = new ABLLexer(session, ByteSource.wrap("SUBST('').".getBytes()), "file.txt"); tok = (ProToken) lexer.nextToken(); assertTrue(tok.isAbbreviated()); lexer = new ABLLexer(session, ByteSource.wrap("SUBSTITUTE('').".getBytes()), "file.txt"); tok = (ProToken) lexer.nextToken(); assertFalse(tok.isAbbreviated()); }