Branch: refs/heads/master
Revision: 21a5fe4
Author: dlongnecke-cray
Log Message:
Merge pull request #17914 from dlongnecke-cray/next-add-control-flow-nodes
next: Add a bunch of statement level uAST nodes
This is for compiler/next
.
Add the following uAST
nodes:
- Begin
- Break
- Cobegin
- Continue
- Defer
- Delete
- Label
- On
- Return
- Yield
Along with support for parsing them, and tests.
Remove the ControlFlow
abstract class from the uAST
class hierarchy.
Add a new abstract class SimpleBlockLike
. Migrate several block-like
constructs to be a child of SimpleBlockLike
(including Block
).
Adjust (yet again) how statements discard expression level comments.
This new approach is internally consistent and can be described as
follows:
- If the statement body is a block, clear all comments to the left
of the opening brace - Else if the statement body is preceded by a keyword, clear all
comments to the left of the keyword - Else create an artificial location at the end of the last
non-statement expression before the start of the statement body,
and clear comments before this location
The parser will have to be rebuilt to accommodate this change. This
should (hopefully) be the last time.
Add a new helper method to the ParserContext
that is called
prepareStmtPieces
. It is general enough to handle the majority of
statements. It will collect/discard comments, determine the block
style, and prepare the body statement list. Refactor the parser
actions of most statements to use this helper.
Reviewed by @mppf, @vasslitvinov, @e-kayrakli. Thanks!
TESTING:
-
[x] All
compiler/next
tests pass -
[x] Can build
chpl
Modified Files:
A compiler/next/include/chpl/uast/Begin.h
A compiler/next/include/chpl/uast/Break.h
A compiler/next/include/chpl/uast/Cobegin.h
A compiler/next/include/chpl/uast/Continue.h
A compiler/next/include/chpl/uast/Defer.h
A compiler/next/include/chpl/uast/Delete.h
A compiler/next/include/chpl/uast/Label.h
A compiler/next/include/chpl/uast/On.h
A compiler/next/include/chpl/uast/Return.h
A compiler/next/include/chpl/uast/SimpleBlockLike.h
A compiler/next/include/chpl/uast/Yield.h
A compiler/next/lib/uast/Begin.cpp
A compiler/next/lib/uast/Break.cpp
A compiler/next/lib/uast/Cobegin.cpp
A compiler/next/lib/uast/Continue.cpp
A compiler/next/lib/uast/Defer.cpp
A compiler/next/lib/uast/Delete.cpp
A compiler/next/lib/uast/Label.cpp
A compiler/next/lib/uast/On.cpp
A compiler/next/lib/uast/Return.cpp
A compiler/next/lib/uast/SimpleBlockLike.cpp
A compiler/next/lib/uast/Yield.cpp
A compiler/next/test/frontend/testParseBegin.cpp
A compiler/next/test/frontend/testParseCobegin.cpp
A compiler/next/test/frontend/testParseDefer.cpp
A compiler/next/test/frontend/testParseDelete.cpp
A compiler/next/test/frontend/testParseLabelContinueBreak.cpp
A compiler/next/test/frontend/testParseOn.cpp
A compiler/next/test/frontend/testParseReturn.cpp
A compiler/next/test/frontend/testParseYield.cpp
R compiler/next/include/chpl/uast/ControlFlow.h
R compiler/next/lib/uast/ControlFlow.cpp
M compiler/next/include/chpl/uast/ASTClassesList.h
M compiler/next/include/chpl/uast/Block.h
M compiler/next/include/chpl/uast/Conditional.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/all-uast.h
M compiler/next/lib/frontend/Parser/ParserContext.h
M compiler/next/lib/frontend/Parser/ParserContextImpl.h
M compiler/next/lib/frontend/Parser/bison-chpl-lib.cpp
M compiler/next/lib/frontend/Parser/bison-chpl-lib.h
M compiler/next/lib/frontend/Parser/chpl.ypp
M compiler/next/lib/uast/Block.cpp
M compiler/next/lib/uast/CMakeLists.txt
M compiler/next/lib/uast/Conditional.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/test/frontend/CMakeLists.txt
M compiler/next/test/frontend/testParseBracketLoop.cpp
M compiler/next/test/frontend/testParseConditional.cpp
M compiler/next/test/frontend/testParseDoWhile.cpp
M compiler/next/test/frontend/testParseFor.cpp
M compiler/next/test/frontend/testParseLocal.cpp
M compiler/next/test/frontend/testParseSerial.cpp
M compiler/passes/convert-uast.cppCompare: Comparing 63fb07876317...21a5fe46de72 · chapel-lang/chapel · GitHub