Skip to content

EndlessSkyCommunity/EndlessParser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EndlessParser

A robust Parser for Endless Sky's data files

Usage

$ pip install endlessparser
>>> from endlessparser import parse
>>> with open("map.txt", "r") as f:
...     nodes = parse(f.read())
...
>>> nodes[0]
GalaxyNode(node_type='galaxy', tokens=['"Milky Way"'], children=[Node(node_type='pos', tokens=['0', '0'], children=[]), Node(node_type='sprite', tokens=['ui/galaxy'], children=[])])
>>> nodes[0].name()
'"Milky Way"'
>>> nodes[0].sprite()
'ui/galaxy'
>>> nodes[0].position()
(0.0, 0.0)

Contributing

Requirements:

  • Python >= 3.7 for syntactic sugar
  • black for formatting (please use it before commiting - it also integrates into most editors)

About

A robust Parser for Endless Sky's data files

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages