X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/test/PHPParser.jj b/net.sourceforge.phpeclipse/src/test/PHPParser.jj index 92e62c8..0637cf1 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.jj +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.jj @@ -87,7 +87,7 @@ public final class PHPParser extends PHPParserSuperclass { /** The cursor in expression stack. */ private static int nodePtr; - public static final boolean PARSER_DEBUG = true; + public static final boolean PARSER_DEBUG = false; public final void setFileToParse(final IFile fileToParse) { PHPParser.fileToParse = fileToParse; @@ -589,19 +589,79 @@ MORE : | <#EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > | - | | )> -| + | )> +//| | | } + SKIP : +{ + : IN_STRING +} + + TOKEN : +{ + : IN_STRING +} + + + TOKEN : +{ + : DOLLAR_IN_STRING +} + + TOKEN : +{ + : PHPPARSING +} + + TOKEN : +{ + : DOLLAR_IN_STRING_EXPR +} + + SPECIAL_TOKEN : +{ + <"{"> : SKIPSTRING +} + + SPECIAL_TOKEN : +{ + <"}"> : IN_STRING +} + + SKIP : +{ + <~[]> +} + + TOKEN : +{ + : DOLLAR_IN_STRING +} + + TOKEN : +{ + +} + + SKIP : +{ + <~[]> +} + + SKIP : +{ + <~[]> +} /* IDENTIFIERS */ TOKEN : { : IN_VARIABLE} - TOKEN : + TOKEN : { |) (||)* > | @@ -618,6 +678,10 @@ MORE : > } + SPECIAL_TOKEN : +{ + < ~[] > : IN_STRING +} /* SEPARATORS */ TOKEN : @@ -1914,6 +1978,7 @@ AbstractVariable VariableSuffix(final AbstractVariable prefix) : Literal Literal() : { final Token token; + StringLiteral literal; } { token = {return new NumberLiteral(token);} @@ -1922,6 +1987,43 @@ Literal Literal() : | token = {return new TrueLiteral(token);} | token = {return new FalseLiteral(token);} | token = {return new NullLiteral(token);} +| literal = evaluableString() {return literal;} +} + +StringLiteral evaluableString() : +{ + ArrayList list = new ArrayList(); + Token start,end; + Token token,lbrace,rbrace; + AbstractVariable var; + Expression expr; +} +{ + start = + ( + + ( + token = {list.add(new Variable(token.image, + token.sourceStart, + token.sourceEnd));} + | + lbrace = + token = + {list.add(new Variable(token.image, + token.sourceStart, + token.sourceEnd));} + rbrace = + ) + )* + end = + { + AbstractVariable[] vars = new AbstractVariable[list.size()]; + list.toArray(vars); + return new StringLiteral(SimpleCharStream.currentBuffer.substring(start.sourceEnd,end.sourceStart), + start.sourceStart, + end.sourceEnd, + vars); + } } FunctionCall Arguments(final Expression func) :