/** * Defines the given name as a macro. * * The String value is lexed into a token stream, which is * used as the macro expansion. * * @throws LexerException if the definition fails or is otherwise illegal. */ public void addMacro(@Nonnull String name, @Nonnull String value) throws LexerException { try { Macro m = new Macro(name); StringLexerSource s = new StringLexerSource(value); for (;;) { Token tok = s.token(); if (tok.getType() == EOF) break; m.addToken(tok); } addMacro(m); } catch (IOException e) { throw new LexerException(e); } }
/** * Defines the given name as a macro. * * The String value is lexed into a token stream, which is * used as the macro expansion. */ public void addMacro(String name, String value) throws LexerException { try { Macro m = new Macro(name); StringLexerSource s = new StringLexerSource(value); for (;;) { Token tok = s.token(); if (tok.getType() == EOF) break; m.addToken(tok); } addMacro(m); } catch (IOException e) { throw new LexerException(e); } }
/** * Defines the given name as a macro. * * The String value is lexed into a token stream, which is * used as the macro expansion. */ public void addMacro(String name, String value) throws LexerException { try { Macro m = new Macro(name); StringLexerSource s = new StringLexerSource(value); for (;;) { Token tok = s.token(); if (tok.getType() == EOF) break; m.addToken(tok); } addMacro(m); } catch (IOException e) { throw new LexerException(e); } }
m.addToken(Token.space); space = false; Token la = source_token_nonwhite(); if (la.getType() == IDENTIFIER && ((idx = args.indexOf(la.getText())) != -1)) { m.addToken(new Token(M_STRING, la.getLine(), la.getColumn(), "#" + la.getText(), m.addToken(tok); m.addToken(Token.space); space = false; paste = false; idx = args.indexOf(tok.getText()); if (idx == -1) m.addToken(tok); else m.addToken(new Token(M_ARG, tok.getLine(), tok.getColumn(), tok.getText(), m.addToken(Token.space); space = false; paste = false; m.addToken(tok); break;
m.addToken(Token.space); space = false; Token la = source_token_nonwhite(); if (la.getType() == IDENTIFIER && ((idx = args.indexOf(la.getText())) != -1)) { m.addToken(new Token(M_STRING, la.getLine(), la.getColumn(), "#" + la.getText(), m.addToken(tok); m.addToken(Token.space); space = false; paste = false; idx = args.indexOf(tok.getText()); if (idx == -1) m.addToken(tok); else m.addToken(new Token(M_ARG, tok.getLine(), tok.getColumn(), tok.getText(), m.addToken(Token.space); space = false; paste = false; m.addToken(tok); break;
m.addToken(Token.space); space = false; Token la = source_token_nonwhite(); if (la.getType() == IDENTIFIER && ((idx = args.indexOf(la.getText())) != -1)) { m.addToken(new Token(M_STRING, la.getLine(), la.getColumn(), "#" + la.getText(), Integer.valueOf(idx))); } else { m.addToken(tok); m.addToken(Token.space); space = false; paste = false; idx = args.indexOf(tok.getText()); if (idx == -1) m.addToken(tok); else m.addToken(new Token(M_ARG, tok.getLine(), tok.getColumn(), tok.getText(), m.addToken(Token.space); space = false; paste = false; m.addToken(tok); break;