@@ -126,8 +126,14 @@ foreignUpper =
126126 eerr (expect row newCol ctx E.CapVar)
127127 else
128128 let
129− !foreign = toForeign fp offset start end
130129 !newState = State fp end terminal indent row newCol ctx
130+ !variable = Text.decodeUtf8 (B.PS fp start (end - start))
131+ !foreign =
132+ if start == offset then
133+ (Nothing, variable)
134+ else
135+ let !home = Text.decodeUtf8 (B.PS fp offset ((start - 1) - offset)) in
136+ (Just home, variable)
131137 in
132138 cok foreign newState noError
133139
@@ -158,7 +164,18 @@ foreignAlpha =
158164 if start == end then
159165 eerr (E.ParseError row newCol (E.Theories ctx [E.LowVar, E.CapVar]))
160166 else
161− cok (toForeign fp offset start end) (State fp end terminal indent row newCol ctx) noError
167+ let
168+ !newState = State fp end terminal indent row newCol ctx
169+ !variable = Text.decodeUtf8 (B.PS fp start (end - start))
170+ in
171+ if start == offset then
172+ if Set.member variable reservedWords then
173+ eerr noError
174+ else
175+ cok (Nothing, variable) newState noError
176+ else
177+ let !home = Text.decodeUtf8 (B.PS fp offset ((start - 1) - offset)) in
178+ cok (Just home, variable) newState noError
162179
163180
164181foreignAlphaHelp :: ForeignPtr Word8 -> Int -> Int -> Int -> (# Int, Int, Int #)
@@ -184,26 +201,6 @@ foreignAlphaHelp fp offset terminal col =
184201
185202
186203
187−-- TO FOREIGN NAME
188−
189−
190−toForeign :: ForeignPtr Word8 -> Int -> Int -> Int -> ( Maybe Text, Text )
191−toForeign fp offset start end =
192− let
193− !qualifier =
194− if start == offset then
195− Nothing
196− else
197− Just (Text.decodeUtf8 (B.PS fp offset ((start - 1) - offset)))
198−
199− !variable =
200− Text.decodeUtf8 (B.PS fp start (end - start))
201− in
202− ( qualifier, variable )
203−
204−
205−
206−
207204---- CHAR CHOMPERS ----
208205
209206