Verified Commit ddcef175 authored by Camil Staps's avatar Camil Staps 🚀

Fix #3: recognise guards in start state

parent 5559140b
...@@ -177,6 +177,7 @@ function highlightClean(func, callback, start) { ...@@ -177,6 +177,7 @@ function highlightClean(func, callback, start) {
[/(::)/, ['punctuation'], 'type'], [/(::)/, ['punctuation'], 'type'],
[/(=>)/, ['punctuation']], [/(=>)/, ['punctuation']],
[/(")/, ['literal literal-string'], 'string'], [/(")/, ['literal literal-string'], 'string'],
[/(\|)/, ['punctuation'], 'guard'],
[/([^\(\)\s]+)/, ['funcname'], 'funcargs'] [/([^\(\)\s]+)/, ['funcname'], 'funcargs']
], ],
moduleName: [ moduleName: [
......
-----
Diag2 l1 l2 :== diag2_ l1 l2
where
diag2_ [|] ys = [|]
diag2_ xs [|] = [|]
diag2_ xs ys = [(ae,be) \\ (a,b) <- takeall xs [|] ys [|], ae <|- a & be <|- b]
where
takeall xin xout yin yout
| morex && morey = [|(nxout,nyout):takeall nxin nxout nyin nyout]
| morey = [|(xout,Tl nyout):takeall xin xout nyin (Tl nyout)]
| morex = [|(nxout,yout):takeall nxin nxout yin yout]
| otherwise = shift xout yout
where
(morex,nxin,nxout) = takexnext xin xout
(morey,nyin,nyout) = takeynext yin yout
takexnext [|x:xs] accu = (True,xs,[|x:accu])
takexnext [|] accu = (False,[|],accu)
takeynext [|y:ys] accu = (True,ys,accu ++| [|y])
takeynext [|] accu = (False,[|],accu)
shift xout [|_:ys] = [|(xout,ys):shift xout ys]
shift _ [|] = [|]
-----
funcname Diag2
whitespace
argument l1
whitespace
argument l2
whitespace
punctuation :==
whitespace
funcname funcname-onlyused diag2_
whitespace
argumentinrhs l1
whitespace
argumentinrhs l2
whitespace \n
keyword where
whitespace \n
funcname diag2_
whitespace
punctuation [|]
whitespace
funcname funcname-onlyused ys
punctuation = [|]
whitespace \n
funcname diag2_
whitespace
argument xs
whitespace
punctuation [|] = [|]
whitespace \n
funcname diag2_
whitespace
argument xs
whitespace
argument ys
whitespace
punctuation =
whitespace
punctuation [(
funcname funcname-onlyused ae
punctuation ,
funcname funcname-onlyused be
punctuation )
whitespace
punctuation \\
whitespace
punctuation (
funcname funcname-onlyused a
punctuation ,
funcname funcname-onlyused b
punctuation )
whitespace
punctuation <-
whitespace
funcname funcname-onlyused takeall
whitespace
argumentinrhs xs
whitespace
punctuation [|]
whitespace
argumentinrhs ys
whitespace
punctuation [|],
whitespace
funcname funcname-onlyused ae
whitespace
punctuation <|-
whitespace
funcname funcname-onlyused a
whitespace
punctuation &
whitespace
funcname funcname-onlyused be
whitespace
punctuation <|-
whitespace
funcname funcname-onlyused b
punctuation ]
whitespace \n
keyword where
whitespace \n
funcname takeall
whitespace
argument xin
whitespace
argument xout
whitespace
argument yin
whitespace
argument yout
whitespace \n
punctuation |
whitespace
funcname funcname-onlyused morex
whitespace
punctuation &&
whitespace
funcname funcname-onlyused morey
punctuation = [|(
funcname funcname-onlyused nxout
punctuation ,
funcname funcname-onlyused nyout
punctuation ):
funcname funcname-onlyused takeall
whitespace
funcname funcname-onlyused nxin
whitespace
funcname funcname-onlyused nxout
whitespace
funcname funcname-onlyused nyin
whitespace
funcname funcname-onlyused nyout
punctuation ]
whitespace \n
punctuation |
whitespace
funcname funcname-onlyused morey
punctuation = [|(
argumentinrhs xout
punctuation ,
constructor Tl
whitespace
funcname funcname-onlyused nyout
punctuation ):
funcname funcname-onlyused takeall
whitespace
argumentinrhs xin
whitespace
argumentinrhs xout
whitespace
funcname funcname-onlyused nyin
whitespace
punctuation (
constructor Tl
whitespace
funcname funcname-onlyused nyout
punctuation )]
whitespace \n
punctuation |
whitespace
funcname funcname-onlyused morex
punctuation = [|(
funcname funcname-onlyused nxout
punctuation ,
argumentinrhs yout
punctuation ):
funcname funcname-onlyused takeall
whitespace
funcname funcname-onlyused nxin
whitespace
funcname funcname-onlyused nxout
whitespace
argumentinrhs yin
whitespace
argumentinrhs yout
punctuation ]
whitespace \n
punctuation |
whitespace
keyword otherwise
punctuation =
funcname funcname-onlyused shift
whitespace
argumentinrhs xout
whitespace
argumentinrhs yout
whitespace \n
keyword where
whitespace \n
punctuation (
funcname morex,nxin,nxout
punctuation )
whitespace
punctuation =
whitespace
funcname funcname-onlyused takexnext
whitespace
argumentinrhs xin
whitespace
argumentinrhs xout
whitespace \n
punctuation (
funcname morey,nyin,nyout
punctuation )
whitespace
punctuation =
whitespace
funcname funcname-onlyused takeynext
whitespace
argumentinrhs yin
whitespace
argumentinrhs yout
whitespace \n
whitespace \n
funcname takexnext
whitespace
punctuation [|
funcname funcname-onlyused x
punctuation :
funcname funcname-onlyused xs
punctuation ]
whitespace
funcname funcname-onlyused accu
punctuation = (
literal literal-bool True
punctuation ,
funcname funcname-onlyused xs
punctuation ,[|
funcname funcname-onlyused x
punctuation :
funcname funcname-onlyused accu
punctuation ])
whitespace \n
funcname takexnext
whitespace
punctuation [|]
whitespace
funcname funcname-onlyused accu
punctuation = (
literal literal-bool False
punctuation ,[|],
funcname funcname-onlyused accu
punctuation )
whitespace \n
whitespace \n
funcname takeynext
whitespace
punctuation [|
funcname funcname-onlyused y
punctuation :
funcname funcname-onlyused ys
punctuation ]
whitespace
funcname funcname-onlyused accu
punctuation = (
literal literal-bool True
punctuation ,
funcname funcname-onlyused ys
punctuation ,
funcname funcname-onlyused accu
whitespace
punctuation ++|
whitespace
punctuation [|
funcname funcname-onlyused y
punctuation ])
whitespace \n
funcname takeynext
whitespace
punctuation [|]
whitespace
funcname funcname-onlyused accu
punctuation = (
literal literal-bool False
punctuation ,[|],
funcname funcname-onlyused accu
punctuation )
whitespace \n
whitespace \n
funcname shift
whitespace
argument xout
whitespace
punctuation [|
argument argument-wildcard _
punctuation :
funcname funcname-onlyused ys
punctuation ] = [|(
argumentinrhs xout
punctuation ,
funcname funcname-onlyused ys
punctuation ):
funcname funcname-onlyused shift
whitespace
argumentinrhs xout
whitespace
funcname funcname-onlyused ys
punctuation ]
whitespace \n
funcname shift
whitespace
argument _
whitespace
punctuation [|] = [|]
Markdown is supported
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