Packages

c

info.kwarc.mmt.api.parser

KeywordBasedParser

class KeywordBasedParser extends Parser

A StructureParser reads MMT declarations (but not objects) and defers to continuation functions for the found StructuralElement, ParsingUnits, and SourceErrors.

This class provides 3 things

1) High-level read methods that read MMT-related entities from a stream, which implementing classes can use. These methods throw do not read more than necessary from the stream and throw SourceError where appropriate.

2) It is stateless and maintains the parse state via an implicit argument of type ParserState in most functions.

3) It leaves processing of MMT entities application-independently via high-level continuation functions.

Source
StructureParser.scala
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. KeywordBasedParser
  2. Parser
  3. LeveledExtension
  4. ObjectParser
  5. StructureParser
  6. FormatBasedExtension
  7. Extension
  8. Logger
  9. AnyRef
  10. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new KeywordBasedParser(objectParser: ObjectParser)

Type Members

  1. case class LocalError(s: String) extends ExtensionError with Product with Serializable

    a custom error class for this extension

    a custom error class for this extension

    Definition Classes
    Extension
  2. class Features extends AnyRef

    holds the structural features and patterns that are available during parsing

    holds the structural features and patterns that are available during parsing

    Attributes
    protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def apply(ps: ParsingStream)(implicit cont: StructureParserContinuations): StructuralElement

    the main interface function: parses a stream and registers all elements (usually a single document) in it

    the main interface function: parses a stream and registers all elements (usually a single document) in it

    ps

    the encapsulated input stream

    cont

    continuations for errors and parsed elements

    returns

    the element into which the stream was parsed (of the type corresponding to ps.parentInfo)

    Definition Classes
    KeywordBasedParserStructureParser
  5. def apply(pu: ParsingUnit)(implicit errorCont: ErrorHandler): ParseResult

    relegates to objectParser

    relegates to objectParser

    Definition Classes
    ParserObjectParser
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def asInterpreter: OneStepInterpreter

    an interpreter that does not check

    an interpreter that does not check

    Definition Classes
    Parser
  8. def catchErrors[A](msg: String, recoverWith: ⇒ A)(code: ⇒ A): A

    like its partner but with return value

    like its partner but with return value

    Attributes
    protected
    Definition Classes
    Extension
  9. def catchErrors(msg: String)(code: ⇒ Unit): Unit

    convenience method for wrapping code in error handler that throws LocalError

    convenience method for wrapping code in error handler that throws LocalError

    Attributes
    protected
    Definition Classes
    Extension
  10. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  11. val controller: Controller

    the controller that this extension is added to; only valid after creation of the extension, i.e., will return null if used in a non-lazy val-field

    the controller that this extension is added to; only valid after creation of the extension, i.e., will return null if used in a non-lazy val-field

    Attributes
    protected
    Definition Classes
    Extension
  12. def currentSourceRegion(implicit state: ParserState): SourceRegion

    the region from the start of the current structural element to the current position

    the region from the start of the current structural element to the current position

    Attributes
    protected
  13. lazy val defaultPrefix: String
    Definition Classes
    Extension
  14. def destroy: Unit

    extension-specific cleanup (override as needed, empty by default)

    extension-specific cleanup (override as needed, empty by default)

    Extensions may create persistent data structures and threads, but they must clean up after themselves in this method

    Definition Classes
    LeveledExtensionExtension
  15. def destroyWhenRemainingTasksFinished: Unit

    convenience for calling waitUntilRemainingTasksFinished and then destroy

    convenience for calling waitUntilRemainingTasksFinished and then destroy

    Definition Classes
    Extension
  16. def end(s: ContainerElement[_])(implicit state: ParserState): Unit

    called at the end of a document or module, does common bureaucracy

    called at the end of a document or module, does common bureaucracy

    Attributes
    protected
  17. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  19. def errorCont(e: ⇒ SourceError)(implicit state: ParserState): Unit

    A continuation function called on every error that occurred

    A continuation function called on every error that occurred

    Attributes
    protected
  20. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  21. val format: String
    Definition Classes
    KeywordBasedParserParser
  22. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  23. def getFeatures(cont: Context): Features
    Attributes
    protected
  24. def getFeatures(mp: MPath): Features

    auxiliary function to collect all structural feature rules in a given context

    auxiliary function to collect all structural feature rules in a given context

    Attributes
    protected
  25. def getFromFirstArgOrEnvvar(args: List[String], name: String, default: String = ""): String
    Attributes
    protected
    Definition Classes
    Extension
  26. def getParseExt(se: StructuralElement, key: String): Option[ParserExtension]

    allow to control certain parser extensions i.e.

    allow to control certain parser extensions i.e. those with side effects like RuleConstantParser

    Attributes
    protected
  27. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  28. def init(controller: Controller): Unit

    MMT initialization (idempotent)

    MMT initialization (idempotent)

    Definition Classes
    LeveledExtensionExtension
  29. def initOther(e: Extension): Unit

    any extension can initialize other extensions if those are not meant to be added to the ExtensionManager

    any extension can initialize other extensions if those are not meant to be added to the ExtensionManager

    Attributes
    protected
    Definition Classes
    Extension
  30. def isApplicable(s: String): Boolean

    returns

    true if this extension is applicable

    Definition Classes
    ParserFormatBasedExtension
  31. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  32. def log(e: Error): Unit

    logs an error - always logged

    logs an error - always logged

    Attributes
    protected
    Definition Classes
    Logger
  33. def log(s: ⇒ String, subgroup: Option[String] = None): Unit

    logs a message with this logger's logprefix

    logs a message with this logger's logprefix

    Attributes
    protected
    Definition Classes
    Logger
  34. def logError(s: ⇒ String): Unit

    log as an error message

    log as an error message

    Attributes
    protected
    Definition Classes
    Logger
  35. def logGroup[A](a: ⇒ A): A

    wraps around a group to create nested logging

    wraps around a group to create nested logging

    Attributes
    protected
    Definition Classes
    Logger
  36. val logPrefix: String

    the prefix used to identify this extension for logging, by default the class name

    the prefix used to identify this extension for logging, by default the class name

    Definition Classes
    KeywordBasedParserExtensionLogger
  37. def logTemp(s: ⇒ String): Unit

    temporary logging - always logged

    temporary logging - always logged

    Attributes
    protected
    Definition Classes
    Logger
  38. def makeError(reg: SourceRegion, s: String, causedBy: Option[Exception] = None)(implicit state: ParserState): SourceError

    convenience function to create SourceError's

    convenience function to create SourceError's

    Attributes
    protected
  39. def makeErrorThrower(msg: String): ErrorHandler

    an ErrorHandler that wraps an error in a LocalError and throws it

    an ErrorHandler that wraps an error in a LocalError and throws it

    Attributes
    protected
    Definition Classes
    Extension
  40. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  41. val noFeatures: Features
  42. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  43. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  44. val objectLevel: ObjectParser
    Definition Classes
    ParserLeveledExtension
  45. def readDPath(implicit state: ParserState): DPath

    read a DPath from the stream throws SourceError iff ill-formed or empty

  46. def readDelimiter(delims: String*)(implicit state: ParserState): String

    reads one out of a list of permitted delimiters

    reads one out of a list of permitted delimiters

    delims

    the permitted delimiter

    returns

    the read delimiter throws SourceError iff anything else found

  47. def readInModule(mod: ModuleOrLink, context: Context, features: Features)(state: ParserState): Unit

    the main loop for reading declarations that can occur in a theory

    the main loop for reading declarations that can occur in a theory

    mod

    the containing module (added already)

    context

    the context (including the containing module)

    features

    the patterns and structural features of the meta-theory (precomputed in readInDocument) this function handles one declaration if possible, then calls itself recursively

  48. def readMPath(newBase: Path)(implicit state: ParserState): (SourceRef, MPath)

    read a MPath from the stream throws SourceError iff ill-formed or empty

  49. def readName(implicit state: ParserState): LocalName

    read a LocalName from the stream throws SourceError iff ill-formed or empty

  50. def readParsedObject(context: Context, topRule: Option[ParsingRule] = None)(implicit state: ParserState): (String, SourceRegion, ParseResult)

    reads until the object delimiter and parses the found string

    reads until the object delimiter and parses the found string

    returns

    the raw string, the region, and the parsed term

  51. def readSPath(newBase: Path)(implicit state: ParserState): GlobalName

    read a GlobalName from the stream throws SourceError iff ill-formed or empty

  52. val report: Report
    Attributes
    protected
    Definition Classes
    ExtensionLogger
  53. def resolveDeclarationName[A <: Declaration](cls: Class[A], parent: ModuleOrLink, name: LocalName)(implicit state: ParserState): LocalName

    resolve a name in a realized theory (e.g, the domain of a link) and report error on failure

    resolve a name in a realized theory (e.g, the domain of a link) and report error on failure

    Attributes
    protected
  54. def seCont(se: StructuralElement)(implicit state: ParserState): Unit

    A continuation function called on every StructuralElement that was found

    A continuation function called on every StructuralElement that was found

    For container elements (documents, modules with body), this must be called on the empty element first and then on each child, finally end(se) must be called on the container element. This holds accordingly for nested declared modules.

    Attributes
    protected
  55. def start(args: List[String]): Unit

    extension-specific initialization (override as needed, empty by default)

    extension-specific initialization (override as needed, empty by default)

    Definition Classes
    Extension
  56. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  57. def toString(): String
    Definition Classes
    AnyRef → Any
  58. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  59. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  60. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  61. def waitUntilRemainingTasksFinished: Unit

    extensions that process tasks in separate threads should override this and wait until those threads are done

    extensions that process tasks in separate threads should override this and wait until those threads are done

    Definition Classes
    Extension

Inherited from Parser

Inherited from LeveledExtension

Inherited from ObjectParser

Inherited from StructureParser

Inherited from FormatBasedExtension

Inherited from Extension

Inherited from Logger

Inherited from AnyRef

Inherited from Any

Ungrouped