Package org.pentaho.reporting.libraries.formula.parser

Examples of org.pentaho.reporting.libraries.formula.parser.GeneratedFormulaParserTokenManager


                formula = aFormula;
            final ArrayList images = new ArrayList();
            try
            {
                int brackets = 0;
                final GeneratedFormulaParserTokenManager tokenParser = new GeneratedFormulaParserTokenManager(new JavaCharStream(new StringReader(formula), 1, 1));
                Token token = tokenParser.getNextToken();
                while (token.kind != GeneratedFormulaParserConstants.EOF)
                {
                    final FormulaToken formulaToken;
                    images.add(token.image);
                    final String upper = token.image.toUpperCase();
                    if ( parserNames.containsKey(upper) )
                    {
                        if ( token.image.equals("("))
                            brackets++;
                        else if ( token.image.equals(")"))
                            --brackets;
                        final FormulaOpCodeMapEntry opCode = (FormulaOpCodeMapEntry) parserNames.get(upper);
                        formulaToken = opCode.Token;
                    }
                    else if ( token.kind == GeneratedFormulaParserConstants.WHITESPACE )
                    {
                        final FormulaOpCodeMapEntry opCode = (FormulaOpCodeMapEntry) specialOpCodes.get(FormulaMapGroupSpecialOffset.SPACES);
                        formulaToken = opCode.Token;
                    }
                    else
                    {
                        formulaToken = new FormulaToken();
                        formulaToken.OpCode = opCodePush.Token.OpCode;
                        formulaToken.Data = new Any(Type.STRING, token.image);
                    }

                    tokens.add(formulaToken);
                    token = tokenParser.getNextToken();
                }
                if ( brackets > 0 )
                {
                    final FormulaOpCodeMapEntry opCode = (FormulaOpCodeMapEntry) parserNames.get(")");
                    while ( brackets-- != 0 )
View Full Code Here


                formula = aFormula;
            final ArrayList images = new ArrayList();
            try
            {
                int brackets = 0;
                final GeneratedFormulaParserTokenManager tokenParser = new GeneratedFormulaParserTokenManager(new JavaCharStream(new StringReader(formula), 1, 1));
                Token token = tokenParser.getNextToken();
                while (token.kind != GeneratedFormulaParserConstants.EOF)
                {
                    final FormulaToken formulaToken;
                    images.add(token.image);
                    final String upper = token.image.toUpperCase();
                    if ( parserNames.containsKey(upper) )
                    {
                        if ( "(".equals(token.image))
                            brackets++;
                        else if ( ")".equals(token.image))
                            --brackets;
                        final FormulaOpCodeMapEntry opCode = (FormulaOpCodeMapEntry) parserNames.get(upper);
                        formulaToken = opCode.Token;
                    }
                    else if ( token.kind == GeneratedFormulaParserConstants.WHITESPACE )
                    {
                        final FormulaOpCodeMapEntry opCode = (FormulaOpCodeMapEntry) specialOpCodes.get(FormulaMapGroupSpecialOffset.SPACES);
                        formulaToken = opCode.Token;
                    }
                    else
                    {
                        formulaToken = new FormulaToken();
                        formulaToken.OpCode = opCodePush.Token.OpCode;
                        formulaToken.Data = new Any(Type.STRING, token.image);
                    }

                    tokens.add(formulaToken);
                    token = tokenParser.getNextToken();
                }
                if ( brackets > 0 )
                {
                    final FormulaOpCodeMapEntry opCode = (FormulaOpCodeMapEntry) parserNames.get(")");
                    while ( brackets-- != 0 )
View Full Code Here

            }
            final ArrayList images = new ArrayList();
            try
            {
                int brackets = 0;
                final GeneratedFormulaParserTokenManager tokenParser = new GeneratedFormulaParserTokenManager(new JavaCharStream(new StringReader(formula), 1, 1));
                Token token = tokenParser.getNextToken();
                while (token.kind != GeneratedFormulaParserConstants.EOF)
                {
                    final FormulaToken formulaToken;
                    images.add(token.image);
                    final String upper = token.image.toUpperCase();
                    if (parserNames.containsKey(upper))
                    {
                        if ("(".equals(token.image))
                        {
                            brackets++;
                        }
                        else if (")".equals(token.image))
                        {
                            --brackets;
                        }
                        final FormulaOpCodeMapEntry opCode = (FormulaOpCodeMapEntry) parserNames.get(upper);
                        formulaToken = opCode.Token;
                    }
                    else if (token.kind == GeneratedFormulaParserConstants.WHITESPACE)
                    {
                        final FormulaOpCodeMapEntry opCode = (FormulaOpCodeMapEntry) specialOpCodes.get(FormulaMapGroupSpecialOffset.SPACES);
                        formulaToken = opCode.Token;
                    }
                    else
                    {
                        formulaToken = new FormulaToken();
                        formulaToken.OpCode = opCodePush.Token.OpCode;
                        formulaToken.Data = new Any(Type.STRING, token.image);
                    }

                    tokens.add(formulaToken);
                    token = tokenParser.getNextToken();
                }
                if (brackets > 0)
                {
                    final FormulaOpCodeMapEntry opCode = (FormulaOpCodeMapEntry) parserNames.get(")");
                    while (brackets-- != 0)
View Full Code Here

                formula = aFormula;
            final ArrayList images = new ArrayList();
            try
            {
                int brackets = 0;
                final GeneratedFormulaParserTokenManager tokenParser = new GeneratedFormulaParserTokenManager(new JavaCharStream(new StringReader(formula), 1, 1));
                Token token = tokenParser.getNextToken();
                while (token.kind != GeneratedFormulaParserConstants.EOF)
                {
                    final FormulaToken formulaToken;
                    images.add(token.image);
                    final String upper = token.image.toUpperCase();
                    if ( parserNames.containsKey(upper) )
                    {
                        if ( "(".equals(token.image))
                            brackets++;
                        else if ( ")".equals(token.image))
                            --brackets;
                        final FormulaOpCodeMapEntry opCode = (FormulaOpCodeMapEntry) parserNames.get(upper);
                        formulaToken = opCode.Token;
                    }
                    else if ( token.kind == GeneratedFormulaParserConstants.WHITESPACE )
                    {
                        final FormulaOpCodeMapEntry opCode = (FormulaOpCodeMapEntry) specialOpCodes.get(FormulaMapGroupSpecialOffset.SPACES);
                        formulaToken = opCode.Token;
                    }
                    else
                    {
                        formulaToken = new FormulaToken();
                        formulaToken.OpCode = opCodePush.Token.OpCode;
                        formulaToken.Data = new Any(Type.STRING, token.image);
                    }

                    tokens.add(formulaToken);
                    token = tokenParser.getNextToken();
                }
                if ( brackets > 0 )
                {
                    final FormulaOpCodeMapEntry opCode = (FormulaOpCodeMapEntry) parserNames.get(")");
                    while ( brackets-- != 0 )
View Full Code Here

            }
            final ArrayList images = new ArrayList();
            try
            {
                int brackets = 0;
                final GeneratedFormulaParserTokenManager tokenParser = new GeneratedFormulaParserTokenManager(new JavaCharStream(new StringReader(formula), 1, 1));
                Token token = tokenParser.getNextToken();
                while (token.kind != GeneratedFormulaParserConstants.EOF)
                {
                    final FormulaToken formulaToken;
                    images.add(token.image);
                    final String upper = token.image.toUpperCase();
                    if (parserNames.containsKey(upper))
                    {
                        if ("(".equals(token.image))
                        {
                            brackets++;
                        }
                        else if (")".equals(token.image))
                        {
                            --brackets;
                        }
                        final FormulaOpCodeMapEntry opCode = (FormulaOpCodeMapEntry) parserNames.get(upper);
                        formulaToken = opCode.Token;
                    }
                    else if (token.kind == GeneratedFormulaParserConstants.WHITESPACE)
                    {
                        final FormulaOpCodeMapEntry opCode = (FormulaOpCodeMapEntry) specialOpCodes.get(FormulaMapGroupSpecialOffset.SPACES);
                        formulaToken = opCode.Token;
                    }
                    else
                    {
                        formulaToken = new FormulaToken();
                        formulaToken.OpCode = opCodePush.Token.OpCode;
                        formulaToken.Data = new Any(Type.STRING, token.image);
                    }

                    tokens.add(formulaToken);
                    token = tokenParser.getNextToken();
                }
                if (brackets > 0)
                {
                    final FormulaOpCodeMapEntry opCode = (FormulaOpCodeMapEntry) parserNames.get(")");
                    while (brackets-- != 0)
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.formula.parser.GeneratedFormulaParserTokenManager

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.