SCM Repository
[smlnj] Diff of /sml/trunk/src/cm/parse/parse.sml
Diff of /sml/trunk/src/cm/parse/parse.sml
Parent Directory
|
Revision Log
|
Patch
187 |
end |
end |
188 |
(* handling line breaks *) |
(* handling line breaks *) |
189 |
fun newline pos = SM.newline sourceMap pos |
fun newline pos = SM.newline sourceMap pos |
190 |
|
(* handling #line directives *) |
191 |
|
fun sync (p, t) = let |
192 |
|
fun sep c = c = #"#" orelse Char.isSpace c |
193 |
|
fun cvt s = getOpt (Int.fromString s, 0) |
194 |
|
fun r (line, col, file) = SM.resynch sourceMap |
195 |
|
(p, { fileName = file, line = line, column = col }) |
196 |
|
in |
197 |
|
case String.tokens sep t of |
198 |
|
[_, line] => |
199 |
|
r (cvt line, NONE, NONE) |
200 |
|
| [_, line, file] => |
201 |
|
r (cvt line, NONE, SOME file) |
202 |
|
| [_, line, col, file] => |
203 |
|
r (cvt line, SOME (cvt col), SOME file) |
204 |
|
| _ => error (p, p + size t) |
205 |
|
"illegal #line directive" |
206 |
|
end |
207 |
in |
in |
208 |
{ enterC = enterC, |
{ enterC = enterC, |
209 |
leaveC = leaveC, |
leaveC = leaveC, |
214 |
getS = getS, |
getS = getS, |
215 |
handleEof = handleEof, |
handleEof = handleEof, |
216 |
newline = newline, |
newline = newline, |
217 |
error = error } |
error = error, |
218 |
|
sync = sync} |
219 |
end |
end |
220 |
|
|
221 |
fun inputc k = TextIO.input stream |
fun inputc k = TextIO.input stream |
|
Legend:
Removed from v.312 |
|
changed lines |
|
Added in v.313 |
|
|