Skip to content

Commit 1114196

Browse files
committed
fix optional field_list in RecordExpression
1 parent cc1f245 commit 1114196

File tree

3 files changed

+12
-7
lines changed
  • language-powerquery/src/Language/PowerQuery
  • language-powerquery-ast/src/Language/PowerQuery/AST

3 files changed

+12
-7
lines changed

language-powerquery-ast/src/Language/PowerQuery/AST/AST.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ data UnaryExpression annotation
146146
-- 12.2.3.10 Primary expression
147147
data PrimaryExpression annotation
148148
= LiteralPE (LiteralExpression annotation)
149-
| ListPE (ListExpression annotation)
150-
| RecordPE (RecordExpression annotation)
149+
| ListPE (ListExpression annotation)
150+
| RecordPE (RecordExpression annotation)
151151
| IdentifierPE (IdentifierExpression annotation)
152152
| SectionAccessPE (SectionAccessExpression annotation)
153153
| ParenthesizedPE (ParenthesizedExpression annotation)
@@ -226,7 +226,7 @@ data Item annotation
226226
-- 12.2.3.18 Record expression
227227
data RecordExpression annotation
228228
= RecordExpression
229-
{ _recordExpression_fieldList :: !([Field annotation])
229+
{ _recordExpression_fieldList :: !(Maybe [Field annotation])
230230
, _recordExpression_annotation :: !(Maybe annotation)
231231
}
232232
deriving (Show, Read, Eq, Data, Typeable, Generic)

language-powerquery/src/Language/PowerQuery/Lexer.x

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ powerquery :-
191191
<0> $whitespace+ { skip }
192192
193193
-- 12.1.2 - Comment
194-
<0> @single_line_comment { mkL CommentT }
194+
<0> @single_line_comment ;
195195
196196
--==========
197197
-- 12.1.5 - number-literal -- TODO

language-powerquery/src/Language/PowerQuery/Parser.y

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,8 @@ list_expression
429429

430430
item_list__opt :: { Maybe [Item Annotation] }
431431
item_list__opt
432-
: item_list { Just $1 }
433-
| {- empty -} { Nothing }
432+
: item_list { Just $1 }
433+
| {- empty -} { Nothing }
434434

435435
item_list :: { [Item Annotation] }
436436
item_list
@@ -445,7 +445,12 @@ item
445445
-- 12.2.3.18 - Record expression
446446
record_expression :: { RecordExpression Annotation }
447447
record_expression
448-
: '[' field_list ']' { RecordExpression $2 (Just Annotation) }
448+
: '[' field_list__opt ']' { RecordExpression $2 (Just Annotation) }
449+
450+
field_list__opt :: { Maybe [Field Annotation] }
451+
field_list__opt
452+
: field_list { Just $1 }
453+
| {- empty -} { Nothing }
449454

450455
field_list :: { [Field Annotation] }
451456
field_list

0 commit comments

Comments
 (0)