summaryrefslogtreecommitdiff
path: root/src/syntax
AgeCommit message (Collapse)Author
2020-08-29Newlines are complicated, y'all ๐Ÿ˜ฑMartin Haug
Co-authored-by: laurmaedje@outlook.de <laurmaedje@outlook.de>
2020-08-29Fixing the build by removing P macro usage ๐Ÿš‘Martin Haug
Kids, merge with caution!
2020-08-29Merge branch 'master' into code-blocksMartin
2020-08-29Added code blocks ๐ŸšŸMartin Haug
2020-08-29Remove par nodes in favor of parbreaks ๐Ÿ”„Laurenz
This basically reverts the earlier change from parbreaks to par nodes because: - It is simpler and less nested - It works way better with functions that layout their body inline like `font`, which where buggy before, previously The original reasons for changing to par nodes were: - the envisioned design of the layouter at that time (based on dynamic nodes etc.), which is not relevant anymore - possibly existing benefits with regards to incremental compilation, which are unsure and outweighed by the immediate benefits of the parbreak-representation
2020-08-27Do as Dolores says โšกLaurenz
2020-08-27Better error reporting for nameless function ๐Ÿ’กLaurenz
2020-08-27Fixing the regression ๐ŸฉนMartin Haug
2020-08-27Code review-tastic changes ๐ŸฆชMartin Haug
2020-08-27Add Multi-Invokation ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘งMartin Haug
2020-08-19Remove some obsolete stuff โŒLaurenz
2020-08-19Make compute functions possible ๐Ÿ’ปLaurenz
Ships with the amazing new `rgb` function!
2020-08-17Parse braced expressions and bracketed calls in headers ๐Ÿ—ณLaurenz
- Refactors the tokenizer to be lazy: It does not emit pre-parsed function tokens, but instead allows it's mode to be changed. The modes are tracked on a stack to allow nested compute/typesetting (pop/push). - Introduces delimited groups into the parser, which make it easy to parse delimited expressions without handling the delimiters in the parsing code for the group's content. A group is started with `start_group`. When reaching the group's end (matching delimiter) the eat and peek methods will simply return `None` instead of the delimiter, stopping the content parser and bubbling up the call stack until `end_group` is called to clear up the situation.
2020-08-16Add Value type and replace dyn-nodes with call-exprs ๐Ÿ—Laurenz
- In addition to syntax trees there are now `Value`s, which syntax trees can be evaluated into (e.g. the tree is `5+5` and the value is `10`) - Parsing is completely pure, function calls are not parsed into nodes, but into simple call expressions, which are resolved later - Functions aren't dynamic nodes anymore, but simply functions which receive their arguments as a table and the layouting context - Functions may return any `Value` - Layouting is powered by functions which return the new `Commands` value, which informs the layouting engine what to do - When a function returns a non-`Commands` value, the layouter simply dumps the value into the document in monospace
2020-08-16Remove tuples and objects in favor of tables ๐Ÿ›ขLaurenz
This refactores the parser tests to make them more concise and flexible with regards to spans.
2020-08-15Remove SpanlessEq ๐ŸŽƒLaurenz
The new solution is slightly hacky, but way more flexible. All types that implement PartialEq can now be compared spanlessly in tests by manipulating a thread-local boolean that is read in Span's PartialEq implementation.
2020-08-15Add table expressions with arg-parsing functions ๐Ÿช”Laurenz
2020-08-15Take references in TryFromExpr ๐Ÿ”ญLaurenz
2020-08-15Rename Value trait into TryFromExpr โœ’Laurenz
2020-08-14Desugar body into last argument ๐ŸฉLaurenz
2020-08-14Add a syntax tree expression kind ๐ŸŽLaurenz
This allows bodies to be passed as regular arguments.
2020-08-14Always parse bodies as syntax trees ๐ŸŒณLaurenz
Previously they were passed as strings to the function parser, now they are parsed and then passed as trees to the function. This allows making bodies sugar for a last content argument. While it removes some flexibility allowing function to parse arbitrary syntaxes in their bodies, these can be modelled as (raw) string arguments.
2020-08-13Use equals sign instead of colon for objects ๐Ÿ“Laurenz
2020-08-13Remove redundant `Expr` prefix from tokens ๐ŸงฝLaurenz
2020-08-04Refactor function parsing โ™ปLaurenz
2020-08-04Par nodes ๐ŸงณLaurenz
2020-08-03Formatting, documentation and small improvements ๐ŸงฝLaurenz
2020-08-02Replace body! macro with functions ๐ŸงฐLaurenz
2020-08-02Refactor model into tree ๐Ÿ›’Laurenz
2020-08-02Move binary into separate crate and tidy dependencies ๐ŸŽญLaurenz
2020-08-02Refactor argument parsing ๐Ÿ”ฌLaurenz
2020-08-02Unify font and page functions ๐Ÿ’•Laurenz
- Removes font weight and width warnings for now, will be added again later - Adds a bit hacky get_first function for tuples, will be refactored soon anyway
2020-08-01Raw lengths ๐ŸšฒLaurenz
Replace unitless length with raw f64 and introduce length type with unit.
2020-08-01Port font handling to fontdock and ttf-parser ๐Ÿ›ณLaurenz
- Use fontdock for indexing fonts and querying - Typst binary now automatically indexes and uses system fonts in addition to a fixed font folder! - Removes subsetting support for now (was half-finished anyways, plan is to use harfbuzz for subsetting in the future) - Adds font width configuration support
2020-07-29Include parens in expression's span (fixes #4) โ˜˜Laurenz
2020-07-29Move, rename and switch some things (boring) ๐ŸššLaurenz
- Problems -> Diagnostics - Position -> Pos - offset_spans -> Offset trait - Size -> Length (and some more size types renamed) - Paper into its own module - scope::Parser -> parsing::CallParser - Create `Decorations` alias - Remove lots of double newlines - Switch from f32 to f64
2020-07-29Improve argument naming and fix grammar in comment โ™ปLaurenz
2020-07-27Refactor parser ๐Ÿš‡Laurenz
2020-07-26Streamline parser and tokenizer test code โœˆLaurenz
2020-07-26Better distinguish function names in tokenizer from parser โœ‚Laurenz
2020-07-26Rename errors to problems and make error! macro more ergonomic ๐ŸงผLaurenz
Also adds a `warning!` macro.
2020-07-18Remove duplicate spans for func args โŒLaurenz
2020-07-18Some code and styling improvements ๐ŸŽจLaurenz
2020-07-18Spanned object pairs and refactoring ๐ŸงตMartin Haug
2020-07-18Parsing mathematical expressions :heavy_plus_sign:Martin Haug
2020-07-16Derive copy for RgbaColor and change debug representation ๐ŸžLaurenz
2020-07-15Use FromStr trait and formatting โœจLaurenz
2020-07-15Healed field for RgbaColors, CodeRev feedback ๐ŸคMartin Haug
2020-07-14Add named tuples and hex color tokensMartin Haug
2020-02-13New syntax features ๐Ÿ‘”Laurenz
- Forced line breaks with backslash followed by whitespace - (Multline) raw text in backticks - Set font class fallbacks with [font.family] (e.g. [font.family: monospace=("CMU Typewriter Text")]) - More sophisticated procedure to find end of function, which accounts for comments, strings, raw text and nested functions (this is a mix of a feature and a bug fix)