if ( codement )
{
...
}
else
{
...
}
现在加入了新的语法分析程序.可以识别一下语句:
1
function
test(a)
2![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
{
3
4
if ( a<0 )
5
print "a<0:"+a
6
else if ( a > 1 )
7![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
8
print "a>1"
9![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
10
else if ( a<10)
11
print "a<10:"+a
12
else if(a >10)
13![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
14
print "a>10:"+a
15![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
16
else
17![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
18
print "a<1"
19![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
20![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
21
}
22![None.gif](/Images/OutliningIndicators/None.gif)
23![None.gif](/Images/OutliningIndicators/None.gif)
24![None.gif](/Images/OutliningIndicators/None.gif)
25![None.gif](/Images/OutliningIndicators/None.gif)
26
上面的语句跟以下语句等价:
![None.gif](/Images/OutliningIndicators/None.gif)
2
![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![ContractedBlock.gif](/Images/OutliningIndicators/ContractedBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
3
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
4
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
5
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
6
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
7
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
8
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
9
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
10
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
11
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
12
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
13
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
14
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
15
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
16
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
17
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
18
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
19
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
20
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
21
![ExpandedBlockEnd.gif](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
22
![None.gif](/Images/OutliningIndicators/None.gif)
23
![None.gif](/Images/OutliningIndicators/None.gif)
24
![None.gif](/Images/OutliningIndicators/None.gif)
25
![None.gif](/Images/OutliningIndicators/None.gif)
26
![None.gif](/Images/OutliningIndicators/None.gif)
1
function
test(a)
2![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
{
3
if ( a< 0 )
4
print "a<0:"+a
5
else
6![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
{
7
if ( a>1 )
8
print "a>1"
9
else
10![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
{
11
if ( a<10 )
12
print "a<10:"+a
13
else
14![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
{
15
if ( a> 10 )
16![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
{
17
print "a>10:"+a
18
}
19
else
20![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
{
21
print "a<1"
22
}
23
}
24![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
25
}
26![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
27
}
28
}
29
Switch语句还没有实现,可能不需要实现了吧
![None.gif](/Images/OutliningIndicators/None.gif)
2
![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![ContractedBlock.gif](/Images/OutliningIndicators/ContractedBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
3
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
4
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
5
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
6
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
7
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
8
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
9
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
10
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
11
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
12
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
13
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
14
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
15
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
16
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
17
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
18
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
19
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
20
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
21
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
22
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
23
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
24
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
25
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
26
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
27
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
28
![ExpandedBlockEnd.gif](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
29
![None.gif](/Images/OutliningIndicators/None.gif)