Thanks to visit codestin.com
Credit goes to github.com

Skip to content

API brainstorming

Thomas Boby edited this page Nov 15, 2019 · 5 revisions

This is just some notes on all the features in cwtools, to work out what could be added into an API.

"Dumb" features (don't need rules)

Parsers

  • Simple pdxscript parser -> List of 1. Comments 2. Key = value 3. Value
  • Advanced pdxscript parser -> List of 1. Comments 2. Key = value 3. Key = { ... } 4. Value with helper functions
  • Parsers for things like setup.log, trigger_docs, data_types.log, jomini log files
  • Localisation parsers (.yml and .csv)

Script files

  • Generic data structure for pdxscript, allowing searching and manipulating
  • Helpers for searching through the data structure
  • Pretty printer (e.g. load file, make changes, write back to disk)

"Smart" features (rely on rules)

File management/Project manager

  • Point it at a folder, it will load and parse all the files (script, localisation, other)
  • Understands overwrite order
  • Supports multiple mods (or vanilla + mods)
  • Info about files, folders, etc
  • Can add new files later and will update

Validation

  • Syntax errors
  • Localisation errors
  • Rule based validation
  • Custom validators (handwritten in code)
  • Track errors across all files
  • Updates when given new files/changes

Metadata

  • Get all "types" (e.g. folders)
  • Get all definitions of a type, with file location, associated localisation and subtypes
  • Get all references to an instance of a type, or just the type in general
  • Get all defined values of a rule-defined "value", and file location
  • Get all saved event targets, scope, and file location
  • Get all trigger/effect blocks (as data structure, e.g. for searching)
  • Get all localisation (with language, key, desc and source)

Language features

  • Get scope stack (THIS, PREV, ROOT, etc) at a position in a file
  • Get information about a position in a file (e.g. type, if it's a reference to another type, if it's localisation)
  • Get the file location where a specific instance of a type is defined (e.g. find where tech_blah is defined)
  • Provide a list of all valid values for a specific point in a file (i.e. completion), with weighting
  • Find all references to something at a specific point in a file
  • Provide the data for a graph of connected types (e.g. all events that are within 2 steps of this event)
Clone this wiki locally