Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
6340496
add 3 new lint rules for proper Chapel formatting
jabraham17 Feb 11, 2026
c72baa5
parser changes needed for new lints
jabraham17 Feb 11, 2026
72ea98a
add fixits for catchs
jabraham17 Feb 13, 2026
bfb6967
add tests for else and catch
jabraham17 Feb 13, 2026
4c2aca1
fix prediff
jabraham17 Feb 13, 2026
786ceb9
fix fixits
jabraham17 Feb 13, 2026
abd2943
fix interface curly locations
jabraham17 Feb 13, 2026
16730ec
refactor rules
jabraham17 Feb 13, 2026
926a2b0
add expression test case
jabraham17 Feb 13, 2026
75c6dbf
fix ifc formal bug
jabraham17 Feb 13, 2026
42887af
fix incorrect indent for ifc formals
jabraham17 Feb 13, 2026
2d2f792
start adding test cases
jabraham17 Feb 13, 2026
011fc3d
fix cobegin incorrect indents
jabraham17 Feb 13, 2026
a9c7d67
make sure manage statements are properly flattened
jabraham17 Feb 13, 2026
ae979ff
add new test cases for incorrect indents
jabraham17 Feb 13, 2026
68468d0
bug fixes for unattached else
jabraham17 Feb 13, 2026
6dbca13
more incorrect indentation fixes
jabraham17 Feb 14, 2026
215019d
more incorrect indent fixes
jabraham17 Feb 14, 2026
71482c2
fix header locations for parenless functions
jabraham17 Feb 14, 2026
b3788a1
handle lifetimes
jabraham17 Feb 14, 2026
cb3d0f8
expand else test case
jabraham17 Feb 14, 2026
49f2413
expand test cases
jabraham17 Feb 14, 2026
8338b93
fix THEN kw location
jabraham17 Feb 14, 2026
a23cb20
finish curly test case
jabraham17 Feb 14, 2026
ab1d9c4
update all rules
jabraham17 Feb 14, 2026
4e206ff
fix parenthesis on if conditional
jabraham17 Feb 17, 2026
b77f62e
cleanup parser
jabraham17 Feb 17, 2026
96b5ed9
more cleanup
jabraham17 Feb 17, 2026
608a19a
fix boollitincond fixit
jabraham17 Feb 17, 2026
a55221c
fix incompatibility with DoKeywordAndBlock
jabraham17 Feb 17, 2026
70a2f27
formatting
jabraham17 Feb 17, 2026
42eff19
add ThenKeywordAndBlock
jabraham17 Feb 17, 2026
baf9400
update good files
jabraham17 Feb 17, 2026
19a4e5d
resolve mason lints
jabraham17 Feb 17, 2026
0e87b20
resolve dists lints
jabraham17 Feb 17, 2026
b594332
update tests
jabraham17 Feb 17, 2026
526566b
avoid curly braces global scopes
jabraham17 Feb 17, 2026
752eba3
fix test
jabraham17 Feb 17, 2026
dba1d2f
add examples
jabraham17 Feb 17, 2026
46e0a7a
fix lint
jabraham17 Feb 17, 2026
44fc179
revert changes to dists
jabraham17 Feb 19, 2026
49a2253
ignore new lints
jabraham17 Feb 19, 2026
ba9b78e
resolve ThenKeywordAndBlock
jabraham17 Feb 19, 2026
be347af
fix spacing
jabraham17 Feb 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile.devel
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ lint-standard-modules: chplcheck FORCE
--disable-rule ControlFlowParentheses \
--disable-rule UnusedFormal \
--disable-rule LineLength \
--disable-rule UnattachedElse \
--disable-rule UnattachedCatch \
--disable-rule UnattachedCurly \
$(MODULES_TO_LINT)

MASON_MODULES_TO_LINT = $(shell find $(CHPL_MAKE_HOME)/tools/mason -name '*.chpl')
Expand Down
2 changes: 2 additions & 0 deletions frontend/include/chpl/uast/all-location-maps.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ LOCATION_MAP(AstNode, BlockHeader)
LOCATION_MAP(NamedDecl, DeclHeader)
LOCATION_MAP(AstNode, ExprParen)
LOCATION_MAP(AstNode, CurlyBraces)
LOCATION_MAP(Conditional, ThenKeyword)
LOCATION_MAP(Conditional, ElseKeyword)
// LOCATION_MAP(AstNode, NamedActual)
// LOCATION_MAP(AstNode, AttributeNamedActual)
// LOCATION_MAP(Function, ReturnIntent)
Expand Down
4 changes: 3 additions & 1 deletion frontend/lib/parsing/ParserContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ struct ParserContext {
void exitScope(asttags::AstTag tag, UniqueString name);

void noteCurlyBraces(YYLTYPE left, YYLTYPE right);
bool isValidCurlyBracesLoc(YYLTYPE loc);
bool hasCurlyBracesLoc();
YYLTYPE curlyBracesLoc();
void resetCurlyBracesLoc();
Expand Down Expand Up @@ -735,7 +736,8 @@ struct ParserContext {

AstNode* buildCatch(YYLTYPE location, AstNode* error,
CommentsAndStmt block,
bool hasParensAroundError);
bool hasParensAroundError,
YYLTYPE parenLocation);

CommentsAndStmt buildWhenStmt(YYLTYPE location,
YYLTYPE headerLocation,
Expand Down
126 changes: 70 additions & 56 deletions frontend/lib/parsing/ParserContextImpl.h

Large diffs are not rendered by default.

2,552 changes: 1,291 additions & 1,261 deletions frontend/lib/parsing/bison-chpl-lib.cpp

Large diffs are not rendered by default.

23 changes: 15 additions & 8 deletions frontend/lib/parsing/bison-chpl-lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,23 @@ extern int yychpl_debug;
struct CommentsAndStmt {
std::vector<ParserComment>* comments;
AstNode* stmt;
TextLocation curlyLoc;
};
static inline
CommentsAndStmt makeCommentsAndStmt(std::vector<ParserComment>* comments,
AstNode* stmt) {
CommentsAndStmt ret = {comments, stmt};
AstNode* stmt, TextLocation curlyLoc) {
CommentsAndStmt ret = {comments, stmt, curlyLoc};
return ret;
}
static inline
CommentsAndStmt makeCommentsAndStmt(std::vector<ParserComment>* comments,
AstNode* stmt) {
return makeCommentsAndStmt(comments, stmt, TextLocation::create());
}
static inline
CommentsAndStmt makeCommentsAndStmt(std::vector<ParserComment>* comments,
owned<AstNode> stmt) {
return makeCommentsAndStmt(comments, stmt.release());
return makeCommentsAndStmt(comments, stmt.release(), TextLocation::create());
}

struct MaybeIntent {
Expand Down Expand Up @@ -194,6 +200,7 @@ extern int yychpl_debug;
ParserExprList* lifetime;
ParserExprList* body;
TextLocation headerLoc;
TextLocation curlyLoc;
};

// A struct to thread along some pieces of a module before it is built.
Expand Down Expand Up @@ -314,12 +321,12 @@ extern int yychpl_debug;
#define YYSTYPE_IS_TRIVIAL 1

#endif
#line 350 "chpl.ypp"
#line 357 "chpl.ypp"

// forward declare ParserContext
struct ParserContext;

#line 323 "bison-chpl-lib.h"
#line 330 "bison-chpl-lib.h"

/* Token kinds. */
#ifndef YYCHPL_TOKENTYPE
Expand Down Expand Up @@ -544,14 +551,14 @@ yychpl_pstate *yychpl_pstate_new (void);
void yychpl_pstate_delete (yychpl_pstate *ps);

/* "%code provides" blocks. */
#line 358 "chpl.ypp"
#line 365 "chpl.ypp"

extern int yychpl_debug;

void yychpl_error(YYLTYPE* loc,
ParserContext* context,
const char* errorMessage);
#line 366 "chpl.ypp"
#line 373 "chpl.ypp"

// include ParserContext.h here because it depends
// upon YYLTYPE and other types defined by the generated parser
Expand All @@ -560,6 +567,6 @@ void yychpl_pstate_delete (yychpl_pstate *ps);
// include override of macro used to compute locations
#include "parser-yylloc-default.h"

#line 564 "bison-chpl-lib.h"
#line 571 "bison-chpl-lib.h"

#endif /* !YY_YYCHPL_BISON_CHPL_LIB_H_INCLUDED */
Loading