Commit 80909b28 authored by John van Groningen's avatar John van Groningen
Browse files

feature, add <^- generator for lazy lists

parent 7b9ac58c
......@@ -4606,19 +4606,22 @@ wantQualifiers pState
where
want_qualifier :: !ParseState -> (!Qualifier, !ParseState)
want_qualifier pState
# (qual_position, pState) = getPosition pState
# (file_position, pState) = getPosition pState
(qual_filename, pState) = accScanState getFilename pState
(lhs_expr, pState) = wantPattern pState
(token, pState) = nextToken FunctionContext pState
#! qual_position = toLineAndColumn file_position
= case token of
LeftArrowToken
-> want_generators IsListGenerator (toLineAndColumn qual_position) qual_filename lhs_expr pState
-> want_generators IsListGenerator qual_position qual_filename lhs_expr pState
LeftArrowWithExclamationToken
-> want_generators IsStrictListGenerator (toLineAndColumn qual_position) qual_filename lhs_expr pState
LeftArrowColonToken
-> want_generators IsArrayGenerator (toLineAndColumn qual_position) qual_filename lhs_expr pState
-> want_generators IsStrictListGenerator qual_position qual_filename lhs_expr pState
LeftArrowWithCaretToken
-> want_generators IsListGenerator qual_position qual_filename lhs_expr pState
LeftArrowWithBarToken
-> want_generators IsOverloadedListGenerator (toLineAndColumn qual_position) qual_filename lhs_expr pState
-> want_generators IsOverloadedListGenerator qual_position qual_filename lhs_expr pState
LeftArrowColonToken
-> want_generators IsArrayGenerator qual_position qual_filename lhs_expr pState
_
-> ({qual_generators = [], qual_let_defs=LocalParsedDefs [], qual_filter = No, qual_position = {lc_line = 0, lc_column = 0}, qual_filename = "" },
parseError "comprehension: qualifier" (Yes token) "qualifier(s)" pState)
......
......@@ -50,9 +50,10 @@ instance <<< FilePosition
| BackSlashToken // \
| DoubleBackSlashToken // \\
| LeftArrowToken // <-
| LeftArrowWithExclamationToken // <-
| LeftArrowColonToken // <-:
| LeftArrowWithExclamationToken // <!-
| LeftArrowWithCaretToken // <^-
| LeftArrowWithBarToken // <|-
| LeftArrowColonToken // <-:
| DotDotToken // ..
| AndToken // &
| HashToken // #
......
......@@ -136,9 +136,10 @@ ScanOptionNoNewOffsideForSeqLetBit:==4;
| BackSlashToken // \
| DoubleBackSlashToken // \\
| LeftArrowToken // <-
| LeftArrowWithExclamationToken // <-
| LeftArrowColonToken // <-:
| LeftArrowWithExclamationToken // <!-
| LeftArrowWithCaretToken // <^-
| LeftArrowWithBarToken // <|-
| LeftArrowColonToken // <-:
| DotDotToken // ..
| AndToken // &
| HashToken // #
......@@ -681,6 +682,18 @@ Scan c0=:'<' input co
| isSpecialChar c2
= ScanOperator 2 input [c2, c1, c0] co
= (IdentToken "<!", charBack input)
| c1=='^'
# (eof, c2, input) = ReadNormalChar input
| eof
= (IdentToken "<^",input)
| c2=='-'
# (eof, c3, input) = ReadNormalChar input
| eof = (LeftArrowWithCaretToken, input)
| isSpecialChar c3 = ScanOperator 3 input [c3, c2, c1, c0] co
= (LeftArrowWithCaretToken, charBack input)
| isSpecialChar c2
= ScanOperator 2 input [c2, c1, c0] co
= (IdentToken "<^", charBack input)
= ScanOperator 0 (charBack input) [c0] co
# (eof, c2, input) = ReadNormalChar input
| eof = (LeftArrowToken, input)
......@@ -1683,8 +1696,9 @@ where
toString DoubleBackSlashToken = "\\\\"
toString LeftArrowToken = "<-"
toString LeftArrowWithExclamationToken = "<!-"
toString LeftArrowColonToken = "<-:"
toString LeftArrowWithCaretToken = "<^-"
toString LeftArrowWithBarToken = "<|-"
toString LeftArrowColonToken = "<-:"
toString DotDotToken = ".."
toString AndToken = "&"
toString HashToken = "#"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment