This project has a handful of .go files and it might not always be clear where
to look for each function call.
Here is a walkthrough of the code layout in a more logical fashion.
rivescript.go- Defines class
RiveScriptandVersion()method. - Internally, also the debug methods like
say()andwarn()
- Defines class
loading.go- Public methods:
LoadFile()LoadDirectory()Stream()SortReplies()
- Internal methods:
parse()
- Public methods:
parser.go- The bulk of the RiveScript source parsing logic is here.
- Private methods:
parseSource()
ast.go- Defines private structures for representing the "abstract syntax tree"
sorting.go- Private methods:
sortTriggerSet()sortList()sortByWords()sortByLength()initSortTrack()
- Private methods:
config.go- Public methods:
SetHandler()/RemoveHandler()SetSubroutine()/RemoveSubroutine()SetGlobal()SetVariable()/GetVariable()SetSubstitution()SetPerson()SetUservar()/SetUservars()GetUserver()/GetUservars()/GetAllUservars()ClearUservars()/ClearAllUservars()FreezeUservars()/ThawUservars()LastMatch()CurrentUser()
- Public methods:
brain.go- Public methods:
Reply()
- Private methods:
getReply()
- Public methods:
tags.go- Code for processing tags on both user messages and responses.
- Private methods:
formatMessage()triggerRegexp()processTags()substitute()
macros.go- Defines
MacroInterface
- Defines
debug.go- Public methods:
DumpTopics()DumpSorted()
- Private methods:
_dumpSorted()_dumpSortedList()
- Public methods:
doc.go- Package documentation.doc_test.go- Examples.
inheritance.go- Private methods:
getTopicTriggers()_getTopicTriggers()getTopicTree()
- Private methods:
regexp.go- Central location for common regular expressions.structs.go- Central location of miscellaneous structs.utils.go- Miscellaneous utility functions.
lang/rivescript_js- JavaScript support.
cmd/rivescript