Branch: refs/heads/master
Revision: 02ccd75
Author: dlongnecke-cray
Log Message:
Merge pull request #17647 from dlongnecke-cray/next-add-local-serial
Add headers/implementation for Local/Serial nodes, adjust parser rules (#17647)
This is for compiler/next
.
Adds AST interfaces for local statements and serial statements, as
well as support for parsing them.
The AST interfaces for local and serial provide a method usesDo
which returns true if the construct was parsed from the following
sort of code:
local foo do {
var x;
}
This may prove useful when building a linter in the future.
In the parser, add a rule called block_stmt_body
which collects the
contents of a block (including comments) into a ParserExprList
without creating a Block AST node. This enables "block-like" nodes
such as local and serial to easily lift the statements in a block
into their own child statement list.
In the parser, make the rule do_stmt
return a structure called
BlockOrDo
. This contains a list of child statements as well as a
flag indicating whether or not the statements were preceded by the
'do' keyword. This may prove useful when parsing other "block-like"
statements.
Add tests testParseLocal.cpp
and testParseSerial.cpp
.
TESTING:
- [x] All
compiler/next
tests pass
Reviewed by @mppf. Thanks!
Signed-off-by: David Longnecker dlongnecke-cray@users.noreply.github.com
Modified Files:
A compiler/next/include/chpl/uast/Local.h
A compiler/next/include/chpl/uast/Serial.h
A compiler/next/lib/frontend/Parser/.gitignore
A compiler/next/lib/uast/Local.cpp
A compiler/next/lib/uast/Serial.cpp
A compiler/next/test/frontend/testParseLocal.cpp
A compiler/next/test/frontend/testParseSerial.cpp
M compiler/next/lib/frontend/Parser/ParserContext.h
M compiler/next/lib/frontend/Parser/ParserContextImpl.h
M compiler/next/lib/frontend/Parser/chapel.ypp
M compiler/next/lib/frontend/Parser/parser-dependencies.h
M compiler/next/lib/uast/CMakeLists.txt
M compiler/next/test/frontend/CMakeLists.txt
Compare: https://github.com/chapel-lang/chapel/compare/7291bf08fcb7...02ccd75968b7