Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

just test #13

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .project
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>tl_git</name>
<name>tl_git_goswitch</name>
<comment></comment>
<projects>
</projects>
Expand Down
10 changes: 8 additions & 2 deletions ext/org/bee/tl/ext/LayoutTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* <p/>
* layout(path,{'paraName1':value1,'paraName2',value2})
*
* 如果变量layoutContent与模板有冲突,可以作为第三个参数传入到layout变量里,如:
* layout(path,{},"xxxLayoutContent");
* @author joelli
* @since 1.1
*
Expand Down Expand Up @@ -117,14 +119,18 @@ public void makeOutput()
}

}
String varName = "layoutContent" ;
if(args.length==3){
varName = (String)args[2];
}

if (this.byteContent)
{
t.set("layoutContent", this.inputBytes);
t.set(varName, this.inputBytes);
}
else
{
t.set("layoutContent", this.input);
t.set(varName, this.input);
}

if (args.length == 2)
Expand Down
15 changes: 14 additions & 1 deletion src/org/bee/tl/core/Bee.g
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ tokens {
SWITCH;
CASE;
DEFAULT;
G_SWITCH;
G_CASE;
G_DEFAULT;
G_CASE_EXPLIST;
JSON;
JSONARRAY;
JSONMAP;
Expand Down Expand Up @@ -146,12 +150,21 @@ statement
| breakStatment ';'!
| returnStatment ';'!
| switchStatment
| g_switchStatment
| nativeMethod[true] ';'!
| directive
;



g_switchStatment
: a='select' ('(' base=exp ')')? '{' g_caseStatment* g_defaultStatment? '}'
->^(G_SWITCH[$a] $base? g_caseStatment* g_defaultStatment? ) ;

g_caseStatment
: a='case' exp (',' exp)* ':' statements ->^(G_CASE[$a] ^(G_CASE_EXPLIST exp+) statements);

g_defaultStatment
: a='default' ':' statements -> ^(G_DEFAULT[$a] statements);

directive: 'DIRECTIVE' Identifier (StringLiteral)? ';' -> ^(DIRECTIVE Identifier (StringLiteral)?);
returnStatment
Expand Down
200 changes: 103 additions & 97 deletions src/org/bee/tl/core/Bee.tokens
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
T__95=95
T__96=96
T__97=97
T__98=98
T__99=99
T__100=100
T__101=101
Expand All @@ -24,6 +20,11 @@ T__117=117
T__118=118
T__119=119
T__120=120
T__121=121
T__122=122
T__123=123
T__124=124
T__125=125
VAR_DEFINE=4
VAR_REFER=5
ASSIGNMENT=6
Expand All @@ -49,97 +50,102 @@ NOT=25
SWITCH=26
CASE=27
DEFAULT=28
JSON=29
JSONARRAY=30
JSONMAP=31
JSONKEYVALUE=32
CLASS_STATIC_FUNCTION=33
CLASS_FUNCTION=34
CLASS_METHOD=35
VARIABLE_VAR_REFER=36
TEXT_VAR_REFER=37
MISSING_VARIABLE_VAR_REFER=38
FUNCTION_FULL_NAME=39
SAFE_OUTPUT=40
DIRECT_CALL=41
NEGATOM=42
WHILE=43
DIRECTIVE=44
Identifier=45
StringLiteral=46
LEFT_BRACE=47
RIGHT_BRACE=48
LEFT_TEXT_TOKEN=49
RIGHT_TOKEN=50
LEFT_TOKEN=51
VAR=52
OR=53
AND=54
EQUAL=55
NOT_EQUAL=56
LARGE=57
LARGE_EQUAL=58
LESS=59
LESS_EQUAL=60
ADD=61
MINUS=62
MULTIP=63
DIV=64
MOD=65
BOOLEAN=66
INT=67
NULL=68
DOUBLE=69
ID_START=70
Comment=71
LineComment=72
DoubleStringCharacter=73
SingleStringCharacter=74
EscapeSequence=75
CharacterEscapeSequence=76
HexEscapeSequence=77
UnicodeEscapeSequence=78
SingleEscapeCharacter=79
NonEscapeCharacter=80
EscapeCharacter=81
DecimalDigit=82
HexDigit=83
DecimalLiteral=84
HexIntegerLiteral=85
NumericLiteral=86
ExponentPart=87
IdentifierStart=88
IdentifierPart=89
UnicodeLetter=90
UnicodeDigit=91
UnicodeConnectorPunctuation=92
UnicodeCombiningMark=93
WhiteSpace=94
';'=95
'DIRECTIVE'=96
'return'=97
'continue'=98
'break'=99
'('=100
','=101
G_SWITCH=29
G_CASE=30
G_DEFAULT=31
G_CASE_EXPLIST=32
JSON=33
JSONARRAY=34
JSONMAP=35
JSONKEYVALUE=36
CLASS_STATIC_FUNCTION=37
CLASS_FUNCTION=38
CLASS_METHOD=39
VARIABLE_VAR_REFER=40
TEXT_VAR_REFER=41
MISSING_VARIABLE_VAR_REFER=42
FUNCTION_FULL_NAME=43
SAFE_OUTPUT=44
DIRECT_CALL=45
NEGATOM=46
WHILE=47
DIRECTIVE=48
Identifier=49
StringLiteral=50
LEFT_BRACE=51
RIGHT_BRACE=52
LEFT_TEXT_TOKEN=53
RIGHT_TOKEN=54
LEFT_TOKEN=55
VAR=56
OR=57
AND=58
EQUAL=59
NOT_EQUAL=60
LARGE=61
LARGE_EQUAL=62
LESS=63
LESS_EQUAL=64
ADD=65
MINUS=66
MULTIP=67
DIV=68
MOD=69
BOOLEAN=70
INT=71
NULL=72
DOUBLE=73
ID_START=74
Comment=75
LineComment=76
DoubleStringCharacter=77
SingleStringCharacter=78
EscapeSequence=79
CharacterEscapeSequence=80
HexEscapeSequence=81
UnicodeEscapeSequence=82
SingleEscapeCharacter=83
NonEscapeCharacter=84
EscapeCharacter=85
DecimalDigit=86
HexDigit=87
DecimalLiteral=88
HexIntegerLiteral=89
NumericLiteral=90
ExponentPart=91
IdentifierStart=92
IdentifierPart=93
UnicodeLetter=94
UnicodeDigit=95
UnicodeConnectorPunctuation=96
UnicodeCombiningMark=97
WhiteSpace=98
';'=99
'select'=100
'('=101
')'=102
'for'=103
'in '=104
'elsefor'=105
'while'=106
'if'=107
'else'=108
'!('=109
'='=110
'!'=111
'.'=112
'.~'=113
'['=114
']'=115
'@'=116
'switch'=117
'{'=47
'}'=48
'case'=118
':'=119
'default'=120
'{'=51
'}'=52
'case'=103
','=104
':'=105
'default'=106
'DIRECTIVE'=107
'return'=108
'continue'=109
'break'=110
'for'=111
'in '=112
'elsefor'=113
'while'=114
'if'=115
'else'=116
'!('=117
'='=118
'!'=119
'.'=120
'.~'=121
'['=122
']'=123
'@'=124
'switch'=125
Loading