Files
Pierre-Marie de Rodat 4382a22f9c Reorganize the source tree
Move most of "ada/*" to the root directory (this makes sense, as this
repository has been dedicated to Libadalang for years), and rename
"ada/language" to "ada".

TN: T914-010
2020-11-02 16:51:46 +01:00

14 lines
324 B
Python

import libadalang
ctx = libadalang.AnalysisContext()
u = ctx.get_from_file('foo.adb')
node = u.root.find(libadalang.Identifier)
t = node.token_start
print('Token data for the "foo" identifier:')
print('Kind: {}'.format(t.kind))
print('Text: {}'.format(t.text))
print('Sloc range: {}'.format(t.sloc_range))
print('Done.')