@Override protected ASTNode parseInternal(IParseContext context) throws ParseException { ITextRegion region = new TextRegion(context.currentParseIndex(), 0); this.macroName = context.parseIdentifier(region, false); if (context.getCurrentlyExpandingMacro() != null) { context.addCompilationError( "Sorry, invoking macros from another macro is currently not implemented", this); } // actual existance of invoked macro is checked by ExpandMacrosPhase region.merge(context.skipWhitespace(false)); if (!context.eof() && context.peek(TokenType.PARENS_OPEN)) { // parse arguments region.merge(context.read(TokenType.PARENS_OPEN)); region.merge(context.skipWhitespace(false)); while (!context.eof() && !context.peek(TokenType.PARENS_CLOSE)) { arguments.add(new MacroArgumentNode().parse(context)); region.merge(context.skipWhitespace(false)); if (context.eof() || context.peek(TokenType.PARENS_CLOSE)) { break; } region.merge(context.read(TokenType.COMMA)); } region.merge(context.read(TokenType.PARENS_CLOSE)); } mergeWithAllTokensTextRegion(region); return this; }