Files
Pierre-Marie de Rodat 9d0d41a826 Add Source_Location as a compiled type
Future work on Lkt will use this compiled type so that properties can
return precisely located errors on string literals.

Note that the exposition of this new compiled type to the OCaml and Java
APIs is incomplete, and is deferred to future developments.
2024-01-11 17:29:43 +00:00

19 lines
332 B
Python

import sys
import libfoolang
print("main.py: Running...")
ctx = libfoolang.AnalysisContext()
u = ctx.get_from_buffer("foo.txt", b"foobar")
if u.diagnostics:
for d in u.diagnostics:
print(d)
sys.exit(1)
sloc = u.root.sloc_range.end
print(f"p_id_sloc({sloc}) = {u.root.p_id_sloc(sloc)}")
print("main.py: Done.")