#+TITLE:Spec for syntax tree
|
|
* Tree components
|
- Document :: Root of AST, contains metadata of title, date, author
|
- Block :: Paragraph level
|
- Table ::
|
- Line :: Main component of Block
|
- Code :: Contains text and language
|
- Heading :: Contains level and words
|
- List :: Contains level, number and words. If number=0, list is unordered
|
- Word :: Token of text
|
- Text :: String single word
|
- MathDisp :: Display level math
|
- MathInline :: Inline level math
|
- Bold :: Bold text, can have multiple words
|
- Italic :: Italic text, can have multiple words
|
- Verbatim :: Verbatim text, can have multiple words
|
- Link :: Link to other place, containing link text and link destination
|
|
Document: Block*
|
Block: Table | Word* | Code
|
Table: Word* (2d array)
|
Code: Straight strings
|
# Line: Heading | List | Word* | MathDisp
|
Word: MathInline | Link | Format | Heading | List | MathDisp
|
Format: Bold | Italic | Verbatim | Text | Underline | Strikethrough
|
Italic: Format
|
Bold: Format
|
Verbatim: Format
|
Link: Text
|
Heading: Word*
|
List: Word*
|
|
|
* Language features and syntax
|
** Org
|
*** Document
|
Title is ~#+TITLE: [Text]~.
|
Author is ~#+AUTHOR: [Text]~.
|
Date is ~#+DATE: [Text]~.
|
*** Block
|
Block are defined by empty/blank lines.
|
*** Table
|
Tables are formatted with vertical pipes separating columns.
|
There may be formatting around boxes of -----.
|
*** Code
|
Code blocks are defined by ~#BEGIN_SRC [language]~ and ~#END_SRC~.
|
There are lines of text in between.
|
*** Heading
|
Heading levels are denoted by the number of '*' beginning the line.
|
REGEX: ~\** [[:TEXT:]]~.
|
*** List
|
List level is denoted by half the number of spaces at the start of the line.
|
The list number is #[.)] or if unordered [-+].
|
ORDERED REGEX: ~[ ]*[[:DIGIT:]]*[.)]~.
|
UNORDERED REGEX: ~[ ]*[-+]~.
|
*** Math
|
Display math is denoted between ~$$ $$~ or ~\[ \]~.
|
Inline math is ~$ $~.
|
*** Formatting
|
Italic is between ~/ /~.
|
Bold is between ~* *~.
|
Verbatim is between ~\~ \~~.
|
Strikethrough is ~+ +~.
|
Underline is ~_ _~.
|
*** Link
|
Links are ~[[destination][text]]~.
|
*** Comments
|
Comments begin with have the regex "^# " and can be omitted.
|