/* Generated By:JJTree&JavaCC: Do not edit this line. ParserTokenManager.java */
package org.apache.velocity.runtime.parser;
import java.io.*;
import java.util.*;
import org.apache.velocity.runtime.RuntimeServices;
import org.apache.velocity.runtime.parser.node.*;
import org.apache.velocity.runtime.directive.Directive;
import org.apache.velocity.runtime.directive.Macro;
import org.apache.velocity.runtime.directive.MacroParseException;
import org.apache.velocity.util.StringUtils;
public class ParserTokenManager implements ParserConstants
{
private int fileDepth = 0;
private int lparen = 0;
private int rparen = 0;
Stack stateStack = new Stack();
public boolean debugPrint = false;
private boolean inReference;
public boolean inDirective;
private boolean inComment;
public boolean inSet;
/**
* pushes the current state onto the 'state stack',
* and maintains the parens counts
* public because we need it in PD & VM handling
*
* @return boolean : success. It can fail if the state machine
* gets messed up (do don't mess it up :)
*/
public boolean stateStackPop()
{
Hashtable h;
try
{
h = (Hashtable) stateStack.pop();
}
catch( EmptyStackException e)
{
lparen=0;
SwitchTo(DEFAULT);
return false;
}
if( debugPrint )
System.out.println(
" stack pop (" + stateStack.size() + ") : lparen=" +
( (Integer) h.get("lparen")).intValue() +
" newstate=" + ( (Integer) h.get("lexstate")).intValue() );
lparen = ( (Integer) h.get("lparen")).intValue();
rparen = ( (Integer) h.get("rparen")).intValue();
SwitchTo( ( (Integer) h.get("lexstate")).intValue() );
return true;
}
/**
* pops a state off the stack, and restores paren counts
*
* @return boolean : success of operation
*/
public boolean stateStackPush()
{
if( debugPrint )
System.out.println(" (" + stateStack.size() + ") pushing cur state : " +
curLexState );
Hashtable h = new Hashtable();
h.put("lexstate", new Integer( curLexState ) );
h.put("lparen", new Integer( lparen ));
h.put("rparen", new Integer( rparen ));
lparen = 0;
stateStack.push( h );
return true;
}
/**
* Clears all state variables, resets to
* start values, clears stateStack. Call
* before parsing.
* @return void
*/
public void clearStateVars()
{
stateStack.clear();
lparen = 0;
rparen = 0;
inReference = false;
inDirective = false;
inComment = false;
inSet = false;
return;
}
/**
* handles the dropdown logic when encountering a RPAREN
*/
private void RPARENHandler()
{
/*
* Ultimately, we want to drop down to the state below
* the one that has an open (if we hit bottom (DEFAULT),
* that's fine. It's just text schmoo.
*/
boolean closed = false;
if (inComment)
closed = true;
while( !closed )
{
/*
* look at current state. If we haven't seen a lparen
* in this state then we drop a state, because this
* lparen clearly closes our state
*/
if( lparen > 0)
{
/*
* if rparen + 1 == lparen, then this state is closed.
* Otherwise, increment and keep parsing
*/
if( lparen == rparen + 1)
{
stateStackPop();
}
else
{
rparen++;
}
closed = true;
}
else
{
/*
* now, drop a state
*/
if(!stateStackPop())
break;
}
}
}
public java.io.PrintStream debugStream = System.out;
public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
private final int jjStopStringLiteralDfa_0(int pos, long active0)
{
switch (pos)
{
case 0:
if ((active0 & 0x10L) != 0L)
return 53;
if ((active0 & 0x30000000L) != 0L)
{
jjmatchedKind = 57;
return 58;
}
if ((active0 & 0x200000000000L) != 0L)
return 45;
if ((active0 & 0x40L) != 0L)
return 60;
if ((active0 & 0x80000000L) != 0L)
return 96;
if ((active0 & 0x70000L) != 0L)
return 7;
return -1;
case 1:
if ((active0 & 0x30000000L) != 0L)
{
jjmatchedKind = 57;
jjmatchedPos = 1;
return 58;
}
if ((active0 & 0x10000L) != 0L)
return 5;
return -1;
case 2:
if ((active0 & 0x30000000L) != 0L)
{
jjmatchedKind = 57;
jjmatchedPos = 2;
return 58;
}
return -1;
case 3:
if ((active0 & 0x10000000L) != 0L)
return 58;
if ((active0 & 0x20000000L) != 0L)
{
jjmatchedKind = 57;
jjmatchedPos = 3;
return 58;
}
return -1;
default :
return -1;
}
}
private final int jjStartNfa_0(int pos, long active0)
{
return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
}
private final int jjStopAtPos(int pos, int kind)
{
jjmatchedKind = kind;
jjmatchedPos = pos;
return pos + 1;
}
private final int jjStartNfaWithStates_0(int pos, int kind, int state)
{
jjmatchedKind = kind;
jjmatchedPos = pos;
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) { return pos + 1; }
return jjMoveNfa_0(state, pos + 1);
}
private final int jjMoveStringLiteralDfa0_0()
{
switch(curChar)
{
case 35:
jjmatchedKind = 17;
return jjMoveStringLiteralDfa1_0(0x50000L);
case 37:
return jjStopAtPos(0, 35);
case 40:
return jjStopAtPos(0, 8);
case 42:
return jjStopAtPos(0, 33);
case 43:
return jjStopAtPos(0, 32);
case 44:
return jjStopAtPos(0, 3);
case 45:
return jjStartNfaWithStates_0(0, 31, 96);
case 46:
return jjMoveStringLiteralDfa1_0(0x10L);
case 47:
return jjStopAtPos(0, 34);
case 58:
return jjStopAtPos(0, 5);
case 61:
return jjStartNfaWithStates_0(0, 45, 45);
case 91:
return jjStopAtPos(0, 1);
case 93:
return jjStopAtPos(0, 2);
case 102:
return jjMoveStringLiteralDfa1_0(0x20000000L);
case 116:
return jjMoveStringLiteralDfa1_0(0x10000000L);
case 123:
return jjStartNfaWithStates_0(0, 6, 60);
case 125:
return jjStopAtPos(0, 7);
default :
return jjMoveNfa_0(0, 0);
}
}
private final int jjMoveStringLiteralDfa1_0(long active0)
{
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(0, active0);
return 1;
}
switch(curChar)
{
case 35:
if ((active0 & 0x40000L) != 0L)
return jjStopAtPos(1, 18);
break;
case 42:
if ((active0 & 0x10000L) != 0L)
return jjStartNfaWithStates_0(1, 16, 5
没有合适的资源?快使用搜索试试~ 我知道了~
velocity-1.5
共1231个文件
html:579个
java:309个
vm:118个
需积分: 12 2 下载量 172 浏览量
2008-06-04
14:24:04
上传
评论
收藏 5.68MB ZIP 举报
温馨提示
velocity-1.5 模板引擎
资源详情
资源评论
资源推荐
收起资源包目录
velocity-1.5 (1231个子文件)
convert-wm.bat 2KB
example.bat 1KB
logger_example.bat 1KB
xmlapp_example.bat 1KB
example2.bat 1KB
buildcp.bat 880B
appendVELCP.bat 872B
appendVELCP.bat 872B
appendVELCP.bat 872B
appendVELCP.bat 872B
Foo.class 372B
encodingtest_KOI8-R.cmp 3KB
output.cmp 3KB
foreach-variable.cmp 2KB
logical.cmp 2KB
test.cmp 2KB
encodingtest3.cmp 2KB
escape2.cmp 1KB
pedantic.cmp 1KB
block.cmp 1KB
velocimacro.cmp 1KB
logical2.cmp 948B
math.cmp 888B
range.cmp 857B
reference.cmp 769B
string.cmp 706B
diabolical.cmp 696B
sample.cmp 679B
include.cmp 678B
escape.cmp 633B
velocity285.vm.cmp 616B
interpolation.cmp 594B
velocity.log.cmp 572B
velocimacro2.cmp 561B
foreach-array.cmp 452B
arithmetic.cmp 384B
foreach-type.cmp 333B
formal.cmp 325B
settest.cmp 319B
parse.cmp 306B
comment.cmp 256B
array.cmp 242B
literal.cmp 187B
map.cmp 175B
foreach-method.cmp 166B
vm_test1.cmp 151B
vm_test2.cmp 148B
foreach-null-list.cmp 146B
loop.cmp 144B
ifstatement.cmp 141B
quotes.cmp 133B
stop3.cmp 133B
equality.cmp 130B
encodingtest.cmp 111B
curly-directive.cmp 101B
foreach-introspect.cmp 99B
encodingtest2.cmp 95B
test2.cmp 93B
single.cmp 92B
stop2.cmp 88B
newline.cmp 87B
string-interpolation.cmp 78B
commas.cmp 76B
stop1.cmp 56B
main.cmp 52B
context_safety1.cmp 51B
context_safety2.cmp 48B
test6.cmp 44B
shorthand.cmp 43B
test3.cmp 42B
test2.cmp 42B
test1.cmp 42B
test2.cmp 42B
test1.cmp 41B
testTemplate3.cmp 40B
foreach-map.cmp 40B
directive.cmp 38B
test4.cmp 36B
testTemplate1.cmp 35B
simpletemplate.cmp 31B
method.cmp 28B
test5.cmp 27B
subclass.cmp 27B
get.cmp 27B
if.cmp 26B
testTemplate4.cmp 24B
multi2.cmp 22B
change2.cmp 22B
testfile.cmp 22B
absolute.cmp 22B
testTemplate2.cmp 21B
multi1.cmp 20B
change1.cmp 20B
path1.cmp 19B
path1.cmp 19B
path2.cmp 19B
set2.cmp 17B
set1.cmp 16B
test3.cmp 15B
comment-eof.cmp 6B
共 1231 条
- 1
- 2
- 3
- 4
- 5
- 6
- 13
100度泡腾
- 粉丝: 2
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0