fixes #892
This commit is contained in:
parent
a5efe84921
commit
896c96134f
4 changed files with 20 additions and 5 deletions
|
|
@ -32,6 +32,7 @@ proc considerAcc*(n: PNode): PIdent =
|
||||||
of nkSym: id.add(x.sym.name.s)
|
of nkSym: id.add(x.sym.name.s)
|
||||||
else: globalError(n.info, errIdentifierExpected, renderTree(n))
|
else: globalError(n.info, errIdentifierExpected, renderTree(n))
|
||||||
result = getIdent(id)
|
result = getIdent(id)
|
||||||
|
of nkOpenSymChoice, nkClosedSymChoice: result = n.sons[0].sym.name
|
||||||
else:
|
else:
|
||||||
globalError(n.info, errIdentifierExpected, renderTree(n))
|
globalError(n.info, errIdentifierExpected, renderTree(n))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@
|
||||||
|
|
||||||
import os, streams, parsexml, strutils
|
import os, streams, parsexml, strutils
|
||||||
|
|
||||||
if paramCount() < 1:
|
if paramCount() < 1:
|
||||||
quit("Usage: htmltitle filename[.html]")
|
quit("Usage: htmltitle filename[.html]")
|
||||||
|
|
||||||
var filename = addFileExt(ParamStr(1), "html")
|
var filename = addFileExt(paramStr(1), "html")
|
||||||
var s = newFileStream(filename, fmRead)
|
var s = newFileStream(filename, fmRead)
|
||||||
if s == nil: quit("cannot open the file " & filename)
|
if s == nil: quit("cannot open the file " & filename)
|
||||||
var x: TXmlParser
|
var x: TXmlParser
|
||||||
|
|
@ -23,13 +23,13 @@ while true:
|
||||||
title.add(x.charData)
|
title.add(x.charData)
|
||||||
x.next()
|
x.next()
|
||||||
if x.kind == xmlElementEnd and cmpIgnoreCase(x.elementName, "title") == 0:
|
if x.kind == xmlElementEnd and cmpIgnoreCase(x.elementName, "title") == 0:
|
||||||
Echo("Title: " & title)
|
echo("Title: " & title)
|
||||||
quit(0) # Success!
|
quit(0) # Success!
|
||||||
else:
|
else:
|
||||||
echo(x.errorMsgExpected("/title"))
|
echo(x.errorMsgExpected("/title"))
|
||||||
|
|
||||||
of xmlEof: break # end of file reached
|
of xmlEof: break # end of file reached
|
||||||
else: nil # ignore other events
|
else: discard # ignore other events
|
||||||
|
|
||||||
x.close()
|
x.close()
|
||||||
quit("Could not determine title!")
|
quit("Could not determine title!")
|
||||||
|
|
|
||||||
3
koch.nim
3
koch.nim
|
|
@ -105,7 +105,8 @@ proc install(args: string) =
|
||||||
|
|
||||||
proc web(args: string) =
|
proc web(args: string) =
|
||||||
exec(("$# cc -r tools/nimweb.nim web/nimrod --putenv:nimrodversion=$#" &
|
exec(("$# cc -r tools/nimweb.nim web/nimrod --putenv:nimrodversion=$#" &
|
||||||
" --path:$#") % [findNim(), NimrodVersion, getCurrentDir()])
|
" --path:$#") % [findNim(), NimrodVersion,
|
||||||
|
getCurrentDir().quoteIfContainsWhite])
|
||||||
|
|
||||||
# -------------- boot ---------------------------------------------------------
|
# -------------- boot ---------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,3 +3,16 @@ import mtempl5
|
||||||
|
|
||||||
echo templ()
|
echo templ()
|
||||||
|
|
||||||
|
#bug #892
|
||||||
|
|
||||||
|
proc parse_to_close(value: string, index: int, open='(', close=')'): int =
|
||||||
|
discard
|
||||||
|
|
||||||
|
# Call parse_to_close
|
||||||
|
template get_next_ident: stmt =
|
||||||
|
discard "{something}".parse_to_close(0, open = '{', close = '}')
|
||||||
|
|
||||||
|
get_next_ident()
|
||||||
|
|
||||||
|
|
||||||
|
#identifier expected, but found '(open|open|open)'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue