Branch: refs/heads/master
Revision: 8b034d2
Author: dlongnecke-cray
Log Message:
Merge pull request #17847 from dlongnecke-cray/next-add-if-statement
next: Add Conditional and parse statement level conditionals
This is for compiler/next
.
This PR adds the header Conditional
and parses statement level
conditionals under the nonterminal if_stmt
.
It also restructures all loops, Local
, and Serial
to use a new enum
called BlockStyle
instead of the flag usesImplicitBlock
.
The enum is defined as follows:
enum struct BlockStyle {
IMPLICIT,
EXPLICIT,
UNNECESSARY_KEYWORD_AND_BLOCK
};
The first two options cover whether or not the block of a construct
used {
curly braces or not. The last covers the third case where
both a keyword and a {
curly were used to transition into the
construct body. For example:
for i in 0..15 do { writeln(i); }
This For
loop would have a blockStyle()
of
UNNECESSARY_KEYWORD_AND_BLOCK
.
While here, also flatten do { ... }
blocks instead of just putting
them into the tree. Now all loops, local, and serial are consistent
in how they flatten blocks.
Reviewed by @vasslitvinov and @stonea. Thanks!
TESTING:
- [x] All
compiler/next
tests pass - [x] All on
linux64
withCOMM=none
Signed-off-by: David Longnecker dlongnecke-cray@users.noreply.github.com
Modified Files:
A compiler/next/include/chpl/uast/BlockStyle.h
A compiler/next/include/chpl/uast/Conditional.h
A compiler/next/lib/uast/Conditional.cpp
A compiler/next/test/frontend/testParseConditional.cpp
M compiler/next/include/chpl/uast/BracketLoop.h
M compiler/next/include/chpl/uast/Coforall.h
M compiler/next/include/chpl/uast/DoWhile.h
M compiler/next/include/chpl/uast/For.h
M compiler/next/include/chpl/uast/Forall.h
M compiler/next/include/chpl/uast/Foreach.h
M compiler/next/include/chpl/uast/IndexableLoop.h
M compiler/next/include/chpl/uast/Local.h
M compiler/next/include/chpl/uast/Loop.h
M compiler/next/include/chpl/uast/Serial.h
M compiler/next/include/chpl/uast/While.h
M compiler/next/lib/frontend/Parser/ParserContext.h
M compiler/next/lib/frontend/Parser/ParserContextImpl.h
M compiler/next/lib/frontend/Parser/chpl.ypp
M compiler/next/lib/frontend/Parser/parser-dependencies.h
M compiler/next/lib/uast/BracketLoop.cpp
M compiler/next/lib/uast/CMakeLists.txt
M compiler/next/lib/uast/Coforall.cpp
M compiler/next/lib/uast/DoWhile.cpp
M compiler/next/lib/uast/For.cpp
M compiler/next/lib/uast/Forall.cpp
M compiler/next/lib/uast/Foreach.cpp
M compiler/next/lib/uast/Local.cpp
M compiler/next/lib/uast/Loop.cpp
M compiler/next/lib/uast/Makefile.include
M compiler/next/lib/uast/Serial.cpp
M compiler/next/lib/uast/While.cpp
M compiler/next/test/frontend/CMakeLists.txt
M compiler/next/test/frontend/testParseBracketLoop.cpp
M compiler/next/test/frontend/testParseCoforall.cpp
M compiler/next/test/frontend/testParseDoWhile.cpp
M compiler/next/test/frontend/testParseFor.cpp
M compiler/next/test/frontend/testParseForall.cpp
M compiler/next/test/frontend/testParseForeach.cpp
M compiler/next/test/frontend/testParseLocal.cpp
M compiler/next/test/frontend/testParseSerial.cpp
M compiler/next/test/frontend/testParseWhile.cpp
Compare: https://github.com/chapel-lang/chapel/compare/7dd8130bad8e...8b034d2971d8