From: axelcl Date: Sun, 8 May 2005 14:30:53 +0000 (+0000) Subject: Parser: parse a PHP expression after 0) { + problemEndPosition = scanner.source.length - 1; + if (problemStartPosition > 0 && problemStartPosition >= problemEndPosition && problemEndPosition > 0) { + problemStartPosition = problemEndPosition - 1; + } + } + throwSyntaxError(error, problemStartPosition, problemEndPosition); } /** @@ -356,30 +362,9 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI throwSyntaxError("End-of-file not reached."); } break; - } catch (SyntaxError sytaxErr1) { + } catch (SyntaxError syntaxError) { + // syntaxError.printStackTrace(); break; - // // if an error occured, - // // try to find keywords 'abstract' 'final' 'class' or 'function' - // // to parse the rest of the string - // boolean tokenize = scanner.tokenizeStrings; - // if (!tokenize) { - // scanner.tokenizeStrings = true; - // } - // try { - // while (token != TokenNameEOF) { - // if (token == TokenNameabstract || token == TokenNamefinal || token == TokenNameclass || token == TokenNamefunction) { - // break; - // } - // getNextToken(); - // } - // if (token == TokenNameEOF) { - // break; - // } - // } catch (SyntaxError sytaxErr2) { - // break; - // } finally { - // scanner.tokenizeStrings = tokenize; - // } } } while (true); @@ -798,7 +783,19 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI } return statement; } else if (token == TokenNameINLINE_HTML) { - getNextToken(); + if (scanner.phpExpressionTag) { + // start of block + getNextToken(); + expr(); + if (token == TokenNameSEMICOLON) { + getNextToken(); + } + if (token != TokenNameINLINE_HTML) { + throwSyntaxError("Missing '?>' for open PHP expression block ('