Package org.eclipse.jst.jsp.core.internal.java.jspel

Examples of org.eclipse.jst.jsp.core.internal.java.jspel.Token


      elParser.Expression();
    }
    catch (ParseException e) {
      int sev = getMessageSeverity(JSPCorePreferenceNames.VALIDATION_EL_SYNTAX);
      if (sev != ValidationMessage.IGNORE) {
        Token curTok = e.currentToken;
        int problemStartOffset = contentDocStart + curTok.beginColumn;
        Message message = new LocalizedMessage(sev, JSPCoreMessages.JSPEL_Syntax);
        message.setOffset(problemStartOffset);
        message.setLength(curTok.endColumn - curTok.beginColumn + 1);
        message.setTargetObject(file);
View Full Code Here


      elParser.Expression();
    }
    catch (ParseException e) {
      int sev = getMessageSeverity(JSPCorePreferenceNames.VALIDATION_EL_SYNTAX);
      if (sev != ValidationMessage.IGNORE) {
        Token curTok = e.currentToken;
        int problemStartOffset = contentStart + curTok.beginColumn;
        Message message = new LocalizedMessage(sev, JSPCoreMessages.JSPEL_Syntax);
        message.setOffset(problemStartOffset);
        message.setLength(curTok.endColumn - curTok.beginColumn + 1);
        message.setTargetObject(file);
View Full Code Here

        }

        public Object visit(ASTValueSuffix node, Object data)
        {
            // for now, only deal with the simple .id suffix
            Token lastToken = node.getLastToken();
      if (node.jjtGetNumChildren() == 0)
            {
                if (!_prefixResolved
                      && node.getFirstToken().kind == JSPELParserConstants.DOT)
                {
View Full Code Here

        }

        public Object visit(ASTValueSuffix node, Object data)
        {
            // for now, only deal with the simple .id suffix
            Token lastToken = node.getLastToken();
      if (node.jjtGetNumChildren() == 0)
            {
                if (!_prefixResolved
                      && node.getFirstToken().kind == JSPELParserConstants.DOT)
                {
View Full Code Here

   */
  private String getPrefix(int relativePosition, String elText) {
    java.io.StringReader reader = new java.io.StringReader(elText);
    JSPELParserTokenManager scanner = new JSPELParserTokenManager(
        new SimpleCharStream(reader, 1, 1));
    Token curToken = null, lastIdentifier = null;
    while (JSPELParserConstants.EOF != (curToken = scanner.getNextToken()).kind) {
      if (JSPELParserConstants.COLON == curToken.kind
          && curToken.endColumn == relativePosition
          && null != lastIdentifier) {
        return (lastIdentifier.image);
View Full Code Here

            final Diagnostic diagnostic =
                operator.validate(choiceArg/* whenTrueArg, whenFalseArg*/);

            if (diagnostic.getSeverity() != Diagnostic.OK)
            {
                final Token firstToken = node.getFirstToken();
                final int offset = _context.getDocumentPosition() + firstToken.beginColumn - 1;
                final int length = node.getLastToken().endColumn - firstToken.beginColumn+1;
                _reporter.report(diagnostic, offset, length);
            }

View Full Code Here

            throw new AssertionError("Literals should be terminal"); //$NON-NLS-1$
        }

        LiteralType type = null;

        final Token  literalToken = node.getFirstToken();

        switch (literalToken.kind)
        {
            case JSPELParserConstants.STRING_LITERAL:
                type = new StringLiteralType(stripQuotes(literalToken.image));
                break;

            case JSPELParserConstants.INTEGER_LITERAL:
                type = new IntegerLiteralType(Long.parseLong(literalToken.image));
                break;

            case JSPELParserConstants.FLOATING_POINT_LITERAL:
                type = new FloatLiteralType(Double.parseDouble(literalToken.image));
                break;

            case JSPELParserConstants.FALSE:
                type = BooleanLiteralType.FALSE;
                break;

            case JSPELParserConstants.TRUE:
                type = BooleanLiteralType.TRUE;
                break;

            case JSPELParserConstants.NULL:
                type = NullLiteralType.SINGLETON;
                break;

            default:
                JSFCorePlugin.log("Unknown EL literal: " +literalToken.toString(), new Throwable("This throwable simply used to mark a stack trace")); //$NON-NLS-1$ //$NON-NLS-2$
        }

        ((EvaluationTracker)data).setType(type);
        return data;
    }
View Full Code Here

        node.childrenAccept(this, data);
        final SignatureBasedType type = ((EvaluationTracker)data).getType();

        if (type != null)
        {
            final Token  firstToken = node.getFirstToken();
            if (UnaryOperator.isUnaryOperator(firstToken))
            {
                if (type instanceof ValueType)
                {
                    final UnaryOperator unaryOp = UnaryOperator.createUnaryOperator(firstToken, _diagnosticFactory);
View Full Code Here

    public Object visit(final ASTValuePrefix node, final Object data)
    {
        if (node.jjtGetNumChildren() == 0)
        {
            final Token token = node.getFirstToken();
            final String image = token.image;

            final ISymbol symbol = _symbolResolver.getVariable(image);

            if (symbol == null)
View Full Code Here

        if (type instanceof IObjectSymbolBasedValueType)
        {
            final IObjectSymbolBasedValueType symbolType =
                (IObjectSymbolBasedValueType) type;
            final Token firstToken = node.getFirstToken();

            if (node.jjtGetNumChildren() == 0
                    && firstToken.kind == JSPELParserConstants.DOT)
            {
                final Token dotId = node.getLastToken();

                final int offset =
                    _context.getDocumentPosition() + dotId.beginColumn - 1;
                final int length = dotId.endColumn - dotId.beginColumn + 1;

                final DotOperator dotOp = new DotOperator(_diagnosticFactory, _targetFile, _symbolResolver);

                final StringLiteralType  suffixLiteral = new StringLiteralType(dotId.image);
                final Diagnostic diagnostic =
                    dotOp.validate(symbolType,
                            suffixLiteral);

                if (diagnostic.getSeverity() != Diagnostic.OK)
                {
                    _reporter.report(diagnostic, offset, length);
                    ((EvaluationTracker) data).setType(null);
                }
                else
                {
                    //                    // if the base (value-a) is a map, then using the bracket value-a['y'] type
                    //                    // syntax is recommended.  Note that we do this here instead of
                    //                    // DotOperator so that we don't tie the default property resolver
                    //                    // behaviour to that operator class.  If someone changes the rules
                    //                    // of how the prop resolver interprets the base, then they may want to
                    //                    // write their own validator that doesn't do this
                    //                    if (symbolType.getSymbol().supportsCoercion(TypeConstants.TYPE_MAP))
                    //                    {
                    //                        _messages.add(ValidationMessageFactory.createFromDiagnostic(
                    //                                DiagnosticFactory.create_BINARY_OP_DOT_WITH_VALUEA_MAP_SHOULD_USE_ARRAY
                    //                                    (symbolType.getSymbol().getName(), dotId.image),
                    //                                        startOffset, length, _targetFile));
                    //                    }

                    ((EvaluationTracker) data).setType(dotOp.performOperation(symbolType,
                            suffixLiteral));
                    tracker.setCurMemberSymbol(offset, length);
                }

                // we finished with the single dot suffix here
                return data;
            }
            else if (firstToken.kind == JSPELParserConstants.LBRACKET)
            {
                final EvaluationTracker subExprTracker = new EvaluationTracker();
                node.childrenAccept(this, subExprTracker);

                final SignatureBasedType subExprType = subExprTracker.getType();

                if (subExprType instanceof ValueType)
                {
                    final Token lastToken = node.getLastToken();
                    final int offset =
                        _context.getDocumentPosition() + firstToken.beginColumn - 1;
                    final int length = lastToken.endColumn - firstToken.beginColumn + 1;

                    final BracketOperator  bracketOperator = new BracketOperator(_diagnosticFactory, _targetFile, _symbolResolver);
View Full Code Here

TOP

Related Classes of org.eclipse.jst.jsp.core.internal.java.jspel.Token

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.