Package org.apache.velocity.runtime.parser

Examples of org.apache.velocity.runtime.parser.Token


        /*
         *  this assumes that we are passed in the root
         *  node of the code block
         */
 
        Token t = rootNode.getFirstToken();
        Token tLast = rootNode.getLastToken();

        /*
         *  now, run down the part of the tree bounded by
         *  our first and last tokens
         */
 
View Full Code Here


            expected.append(eol).append("    ");
        }

        StringBuffer retval = new StringBuffer("Encountered \"");
        Token tok = currentToken.next;

        for (int i = 0; i < maxSize; i++)
        {
            if (i != 0)
            {
View Full Code Here

         * compare with ")" is a simple #foo() style macro, comparing to
         * "#end" is a block style macro. We use starts with because the token
         * may end with '\n'
         */
        List<Token> tokens=node.getTokens();
        Token t = tokens.get(tokens.size()-1);
        if (t.image.startsWith(")") || t.image.startsWith("#end"))
        {
            RuntimeServices rsvc=VelocityUtil.getEngine().getRuntimeServices();
            strictRef = rsvc.getBoolean(RuntimeConstants.RUNTIME_REFERENCES_STRICT, false);
        }
View Full Code Here

     * @param data
     * @return The data object.
     */
    public Object init(InternalContextAdapter context, Object data)
    {
        Token t = tokens.get(0);

        int loc1 = t.image.indexOf("##");
        int loc2 = t.image.indexOf("#*");

        if (loc1 == -1 && loc2 == -1)
View Full Code Here

     */
    public static StrBuilder getSpecialText(Token t)
    {
        StrBuilder sb = new StrBuilder();

        Token tmp_t = t.specialToken;

        while (tmp_t.specialToken != null)
        {
            tmp_t = tmp_t.specialToken;
        }
View Full Code Here

        return true;
    }

    private String getRoot()
    {
        Token t = tokens.get(0);

        /*
         *  we have a special case where something like
         *  $(\\)*!, where the user want's to see something
         *  like $!blargh in the output, but the ! prevents it from showing.
View Full Code Here

     * @see org.apache.velocity.runtime.parser.node.SimpleNode#init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)
     */
    public Object init( InternalContextAdapter context, Object data)
    throws TemplateInitException
    {
        Token t = tokens.get(0);

        String text = NodeUtils.tokenLiteral( t );

        ctext = text.toCharArray();

View Full Code Here

    /**
     * @see org.apache.velocity.runtime.parser.node.Node#jjtClose()
     */
    public void jjtClose()
    {
        Token last = parser.getToken(0); // added
        parser = null;
       
        tokens=new ArrayList<Token>();
        Token t=jjtFirst;
        while(t!=null) {
            Token n=new Token();
            n.beginColumn=t.beginColumn; n.endColumn=t.endColumn;
            n.beginLine=t.beginLine; n.image=t.image;
            n.kind=t.kind; n.endLine=t.endLine;
            n.specialToken=t.specialToken;
            tokens.add(n);
View Full Code Here

      */
    private Object showNode(Node node, Object data)
    {
        String tokens = "";
        String special = "";
        Token t;

        if (showTokens)
        {
            t = node.getTokens().get(0);

View Full Code Here

         *
         * so, only if interpolation is turned on AND it starts with a " AND it
         * has a directive or reference, then we can interpolate. Otherwise,
         * don't bother.
         */
        Token ff=tokens.get(0);
        interpolate = rsvc.getBoolean(
                RuntimeConstants.INTERPOLATE_STRINGLITERALS, true)
                && ff.image.startsWith("\"")
                && ((ff.image.indexOf('$') != -1) || (ff.image
                        .indexOf('#') != -1));
View Full Code Here

TOP

Related Classes of org.apache.velocity.runtime.parser.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.