@@ -126,8 +126,14 @@ foreignUpper =
126 eerr (expect row newCol ctx E.CapVar)
126 eerr (expect row newCol ctx E.CapVar)
129− !foreign = toForeign fp offset start end
130 !newState = State fp end terminal indent row newCol ctx
129 !newState = State fp end terminal indent row newCol ctx
130+ !variable = Text.decodeUtf8 (B.PS fp start (end - start))
132+ if start == offset then
135+ let !home = Text.decodeUtf8 (B.PS fp offset ((start - 1) - offset)) in
136+ (Just home, variable)
132 cok foreign newState noError
138 cok foreign newState noError
@@ -158,7 +164,18 @@ foreignAlpha =
158 if start == end then
164 if start == end then
159 eerr (E.ParseError row newCol (E.Theories ctx [E.LowVar, E.CapVar]))
165 eerr (E.ParseError row newCol (E.Theories ctx [E.LowVar, E.CapVar]))
161− cok (toForeign fp offset start end) (State fp end terminal indent row newCol ctx) noError
168+ !newState = State fp end terminal indent row newCol ctx
169+ !variable = Text.decodeUtf8 (B.PS fp start (end - start))
171+ if start == offset then
172+ if Set.member variable reservedWords then
175+ cok (Nothing, variable) newState noError
177+ let !home = Text.decodeUtf8 (B.PS fp offset ((start - 1) - offset)) in
178+ cok (Just home, variable) newState noError
164foreignAlphaHelp :: ForeignPtr Word8 -> Int -> Int -> Int -> (# Int, Int, Int #)
181foreignAlphaHelp :: ForeignPtr Word8 -> Int -> Int -> Int -> (# Int, Int, Int #)
@@ -184,26 +201,6 @@ foreignAlphaHelp fp offset terminal col =
190−toForeign :: ForeignPtr Word8 -> Int -> Int -> Int -> ( Maybe Text, Text )
191−toForeign fp offset start end =
194− if start == offset then
197− Just (Text.decodeUtf8 (B.PS fp offset ((start - 1) - offset)))
200− Text.decodeUtf8 (B.PS fp start (end - start))
202− ( qualifier, variable )
207---- CHAR CHOMPERS ----
204---- CHAR CHOMPERS ----