fix #1017
This commit is contained in:
parent
1fc770e749
commit
08542175da
|
|
@ -2,7 +2,7 @@
|
|||
// This CSharp output file generated by Gardens Point LEX
|
||||
// Version: 1.1.3.301
|
||||
// Machine: IVAN-PC
|
||||
// DateTime: 24.07.2018 21:27:49
|
||||
// DateTime: 06.08.2018 09:43:06
|
||||
// UserName: Ivan
|
||||
// GPLEX input file <ABCPascal.lex>
|
||||
// GPLEX frame file <embedded resource>
|
||||
|
|
|
|||
|
|
@ -3690,10 +3690,13 @@ variable
|
|||
| variable tkQuestionSquareOpen format_expr tkSquareClose
|
||||
{
|
||||
var fe = $3 as format_expr; // SSM 9/01/17
|
||||
if (fe.expr == null)
|
||||
fe.expr = new int32_const(int.MaxValue,@3);
|
||||
if (fe.format1 == null)
|
||||
fe.format1 = new int32_const(int.MaxValue,@3);
|
||||
if (!parsertools.build_tree_for_formatter)
|
||||
{
|
||||
if (fe.expr == null)
|
||||
fe.expr = new int32_const(int.MaxValue,@3);
|
||||
if (fe.format1 == null)
|
||||
fe.format1 = new int32_const(int.MaxValue,@3);
|
||||
}
|
||||
$$ = new slice_expr_question($1 as addressed_value,fe.expr,fe.format1,fe.format2,@$);
|
||||
}
|
||||
| variable tkRoundOpen optional_expr_list tkRoundClose
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// GPPG version 1.3.6
|
||||
// Machine: IVAN-PC
|
||||
// DateTime: 24.07.2018 21:27:52
|
||||
// DateTime: 06.08.2018 09:43:08
|
||||
// UserName: Ivan
|
||||
// Input file <ABCPascal.y>
|
||||
|
||||
|
|
@ -5806,10 +5806,13 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
|
|||
case 683: // variable -> variable, tkQuestionSquareOpen, format_expr, tkSquareClose
|
||||
{
|
||||
var fe = ValueStack[ValueStack.Depth-2].ex as format_expr; // SSM 9/01/17
|
||||
if (fe.expr == null)
|
||||
fe.expr = new int32_const(int.MaxValue,LocationStack[LocationStack.Depth-2]);
|
||||
if (fe.format1 == null)
|
||||
fe.format1 = new int32_const(int.MaxValue,LocationStack[LocationStack.Depth-2]);
|
||||
if (!parsertools.build_tree_for_formatter)
|
||||
{
|
||||
if (fe.expr == null)
|
||||
fe.expr = new int32_const(int.MaxValue,LocationStack[LocationStack.Depth-2]);
|
||||
if (fe.format1 == null)
|
||||
fe.format1 = new int32_const(int.MaxValue,LocationStack[LocationStack.Depth-2]);
|
||||
}
|
||||
CurrentSemanticValue.ex = new slice_expr_question(ValueStack[ValueStack.Depth-4].ex as addressed_value,fe.expr,fe.format1,fe.format2,CurrentLocationSpan);
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
6
TestSuite/formatter_tests/input/slice2.pas
Normal file
6
TestSuite/formatter_tests/input/slice2.pas
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
begin
|
||||
var a := arr(1,2,3);
|
||||
a?[:2].println;
|
||||
a?[2:].println;
|
||||
a?[2:3].println
|
||||
end.
|
||||
5
TestSuite/formatter_tests/should/slice.pas
Normal file
5
TestSuite/formatter_tests/should/slice.pas
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
begin
|
||||
var a := arr(1, 2, 3);
|
||||
a[:2].println;
|
||||
a[2:].println
|
||||
end.
|
||||
6
TestSuite/formatter_tests/should/slice2.pas
Normal file
6
TestSuite/formatter_tests/should/slice2.pas
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
begin
|
||||
var a := arr(1, 2, 3);
|
||||
a?[:2].println;
|
||||
a?[2:].println;
|
||||
a?[2:3].println
|
||||
end.
|
||||
Loading…
Reference in a new issue