File idxGen.icn |
This file is part of the (main) package.
Source code.Details |
Procedures: |
-------------------------------------------------------------------------------- Generate alternatives from s A(B|b)cd -> ABcd , Abcd word(|s) -> word, words (E|e)at(en||ing) -> Eaten, Eat, Eating, eaten, eat, eating science( |-)fiction -> science fiction, science-fiction etc. A malformed line results in "???"
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-------------------------------------------------------------------------------- Return the number of cores reported by &features
-------------------------------------------------------------------------------- Remove whitespace and replace it by a single plus sign
-------------------------------------------------------------------------------- Return a string containing the entire contents of a file
-------------------------------------------------------------------------------- succeeed if s is an extended search command (i.e. apart from leading plus signs, has a plus sign before the end of the string or before a colon char) Also, if it has a space (which will get turned into a plus sign).
-------------------------------------------------------------------------------- Succeed if the line should not be analysed
getIndexTerms(filename:string)
-------------------------------------------------------------------------------- analyse the XML index configuration file
--------------------------------------------------------------------------------
-------------------------------------------------------------------------------- analyse "aaa+bbb+ccc ..." or "a+4+bbb..." and produce a list ["aaa",1,"bbb",1,"ccc" ...] or ["a", 4, "bbb" ...}
-------------------------------------------------------------------------------- Gobble text up to the next paragraph break; split it into lines and words. For each word, store the line of occurrence and it's ordinal position. The consumed text is removed from the source string. The data is returned to the caller inside the paragraph structure.
--------------------------------------------------------------------------------
-------------------------------------------------------------------------------- return s stripped of leading "+" chars
postIndex(filename:string, waiter)
-------------------------------------------------------------------------------- index a file by looking for index terms and placing \index commands beforehand
--------------------------------------------------------------------------------
Records: |
multiIndex(indexTerm, searchList)
A multiple word search record contains the index term to be used plus the search (which is a list of words, interspersed with the distance between them). so "Bill+Ben+3+Flowerpot" will result in searchList being ["Bill", 1, "Ben", 3, "Flowerpot"]
paragraph(sourceText, lines, words, inProgress)
A paragraph record holds the remaining text of the whole file, together with a list of lines of the current paragraph and a map from each word to a list of occurrences in the paragraph. An occurrence is (line no, ordinal position) inProgress is a set of index terms that are being defined by \PrimaryIndexBegin{term} ... \PrimaryIndexEnd{term}. Normal index hits for term are suppressed in between the PrimaryIndexBegin ... End lines.
Global variables: |