From ae7ce9f89348dbfa863325ac5fb7ac0b8e0ba1d2 Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Tue, 30 Jul 2019 18:33:22 +0100 Subject: [PATCH] CSS tweaks (mostly for mobile devices) and a slight rewording of re2c description. --- src/_templates/sidebar-home.html | 6 +- src/_templates/sidebar.html | 4 +- src/conf.py | 4 +- src/index.rst | 75 +++++++----------- src/manual/manual.rst | 3 - .../undefined_control_flow/default_vs_any.rst | 4 +- src/theme-re2c/static/pygments.css | 4 +- src/theme-re2c/static/theme-re2c.css | 77 ++++++++++++++----- 8 files changed, 99 insertions(+), 78 deletions(-) diff --git a/src/_templates/sidebar-home.html b/src/_templates/sidebar-home.html index 7e676a2b..9874339e 100644 --- a/src/_templates/sidebar-home.html +++ b/src/_templates/sidebar-home.html @@ -3,9 +3,11 @@

Documentation

-{{ toctree(includehidden=True, maxdepth=1) }} +
+ {{ toctree(includehidden=True, maxdepth=1) }} +
-

Community

+

Home

{{ toc }}
diff --git a/src/_templates/sidebar.html b/src/_templates/sidebar.html index 5118040e..abdaa7ad 100644 --- a/src/_templates/sidebar.html +++ b/src/_templates/sidebar.html @@ -3,7 +3,9 @@

Home

-{{ toctree(includehidden=True, maxdepth=1) }} +
+ {{ toctree(includehidden=True, maxdepth=1) }} +
{%- if display_toc %}

{{ title }}

diff --git a/src/conf.py b/src/conf.py index b9eec550..df6ee4c5 100644 --- a/src/conf.py +++ b/src/conf.py @@ -204,8 +204,8 @@ html_last_updated_fmt = '%b %d, %Y' # Custom sidebar templates, maps document names to template names. #html_sidebars = {} html_sidebars = { - 'index': ['sidebar-home.html'], - '*/**': ['sidebar.html'] + 'index': ['sidebar-home.html'], # 'searchbox.html' + '*/**': ['sidebar.html'] # 'searchbox.html' } # Additional templates that should be rendered to pages, maps page names to diff --git a/src/index.rst b/src/index.rst index 4ba3e722..a7d51ce9 100644 --- a/src/index.rst +++ b/src/index.rst @@ -9,55 +9,36 @@ re2c Download & build Releases -Re2c is a free and open-source lexer generator for C and C++. -Its most distinctive features are the following: - - **Very fast lexers.** - The main goal of re2c is to generate lexers that match or exceed the - speed of carefully optimized hand-written code. Instead of using traditional - table-driven approach, re2c encodes the underlying finite state - automaton directly in the form of conditional jumps. The resulting programs - are faster and often smaller than their table-driven counterparts, and they - are much easier to debug, understand and optimize. Re2c applies quite a few - optimizations in order to further speed up and compress the generated code. - - **Flexible user interface.** - Instead of assuming a fixed program template, re2c leaves the definition of - the interface code to the user. It exposes a number of primitives which - should be defined in the form of C/C++ functions, variables and macros. In - addition, re2c allows to configure almost every aspect of the generated - code. All this gives the users a lot of freedom in the way they bind the - generated lexer to their particular environment and allows them to avoid - unnecessary overhead and decide on the optimal input model, buffering, - end-of-input checking mechanism and other aspects. - - **Fast lightweight submatch extraction.** - Re2c uses a - `novel algorithm <2017_trofimovich_tagged_deterministic_finite_automata_with_lookahead.pdf>`_ - that allows it to perform submatch extraction without the overhead on full - parsing. The overhead is proportional to submatch detalization: for only a - few submatch positions it is barely noticeable, and for a moderate number of - submatch positions the overhead is still small. This corresponds to the main - re2c idea --- the users should only pay for what they really use. +Re2c is a free and open-source lexer generator for C and C++. +The main goal of the project is to generate *very fast* lexers that match or +exceed the speed of carefully optimized hand-written code. Instead of using +traditional table-driven approach, re2c encodes the underlying finite state +automata directly in the form of conditional jumps and applies numerous optimizations to the generated code. +The resulting programs are faster and often smaller than their table-driven counterparts, and they +are much easier to debug and understand. +Re2c has an unusual *flexible user interface*: +instead of assuming a fixed program template, it leaves the definition of +the interface code to the user and allows to configure almost every aspect of the generated +code. This gives the users a lot of freedom in the way they bind the +lexer to their particular environment and allows them to decide on the optimal input model. +Re2c supports *fast and lightweight submatch extraction* +which does not requre the overhead on full parsing --- a feature that is rarely found in the wild. +Re2c is used by many other projects +(such as +`PHP `_, +`ninja `_, +`yasm `_, +`spamassassin `_ and +`BRL-CAD `_) +and aims at being fully backward compatible. +On the other hand, it is a research project and a playground for the development of new algorithms in the field of formal grammars and automata. + .. |feed| image:: feed/feed/feed.png :target: feed/atom.xml :class: feed :width: 2em -Re2c aims at being fully backward compatible and never breaking existing code. -It is used by many other projects, most notably -`PHP `_, -`ninja `_, -`yasm `_, -`spamassassin `_, -`BRL-CAD `_ -and re2c itself. -At the same time, re2c is a research project: the core of it is old and stable, -but some of the more recent features are a playground for experiments and -development of new algorithms in the field of formal grammars and automata -theory. - |feed| `Subscribe `_ to receive the latest news and updates. See the `user manual `_ for a complete overview with examples. @@ -79,19 +60,19 @@ Papers Re2c is a research project. It is described in the following papers: - `"RE2C: a more versatile scanner generator" - <../1994_bumbulis_cowan_re2c_a_more_versatile_scanner_generator.ps>`_ + <1994_bumbulis_cowan_re2c_a_more_versatile_scanner_generator.ps>`_ by Peter Bumbulis and Donald D. Cowan, ACM Letters on Programming Languages and Systems (LOPLAS), 1994 - `"Tagged Deterministic Finite Automata with Lookahead" - <../2017_trofimovich_tagged_deterministic_finite_automata_with_lookahead.pdf>`_ + <2017_trofimovich_tagged_deterministic_finite_automata_with_lookahead.pdf>`_ by Ulya Trofimovich, arXiv:1907.08837, 2017 - `"Efficient POSIX submatch extraction on NFA" - <../2019_borsotti_trofimovich_efficient_posix_submatch_extraction_on_nfa.pdf>`_ + <2019_borsotti_trofimovich_efficient_posix_submatch_extraction_on_nfa.pdf>`_ by Angelo Borsotti and Ulya Trofimovich, 2017 @@ -100,7 +81,7 @@ Authors Re2c was originally written by Peter Bumbulis (peter@csg.uwaterloo.ca) and described in research article `"RE2C: a more versatile scanner generator" -<../1994_bumbulis_cowan_re2c_a_more_versatile_scanner_generator.ps>`_ +<1994_bumbulis_cowan_re2c_a_more_versatile_scanner_generator.ps>`_ by Peter Bumbulis and Donald Cowan, 1994. Since then re2c has been maintained and developed by multiple volunteers, most notably, diff --git a/src/manual/manual.rst b/src/manual/manual.rst index 7fc6acf4..62fb2670 100644 --- a/src/manual/manual.rst +++ b/src/manual/manual.rst @@ -2,9 +2,6 @@ User manual +++++++++++ -.. contents:: - :local: - Syntax ====== .. include:: /manual/syntax/syntax.rst_ diff --git a/src/manual/warnings/undefined_control_flow/default_vs_any.rst b/src/manual/warnings/undefined_control_flow/default_vs_any.rst index ede9b125..d3eb1900 100644 --- a/src/manual/warnings/undefined_control_flow/default_vs_any.rst +++ b/src/manual/warnings/undefined_control_flow/default_vs_any.rst @@ -1,5 +1,5 @@ -The difference between ``*`` and ``[^]`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The old default rule +~~~~~~~~~~~~~~~~~~~~ When the world was young and re2c didn't have the default ``*`` rule (that is, before re2c-0.13.7) everyone used ``[^]`` as the default rule, as in this diff --git a/src/theme-re2c/static/pygments.css b/src/theme-re2c/static/pygments.css index 745ba254..00eb4c38 100644 --- a/src/theme-re2c/static/pygments.css +++ b/src/theme-re2c/static/pygments.css @@ -3,7 +3,7 @@ .linenos { color: darkgray; - font-size: 14px; /* must be in sync with .highlight */ + font-size: 85%; /* must be in sync with .highlight */ } .highlight { @@ -13,7 +13,7 @@ background-color: aliceblue; display: block; overflow: auto; - font-size: 14px; /* must be in sync with .linenos */ + font-size: 85%; /* must be in sync with .linenos */ color: darkslategray; } diff --git a/src/theme-re2c/static/theme-re2c.css b/src/theme-re2c/static/theme-re2c.css index aded7494..b0c3157c 100644 --- a/src/theme-re2c/static/theme-re2c.css +++ b/src/theme-re2c/static/theme-re2c.css @@ -1,16 +1,12 @@ - - - body { background-color: white; font-family: sans-serif; margin: 0; + font-size: 16px; } - - div.document { - margin: 0 0 0 20%; + margin: 0 0 0 360px; padding: 1em; text-align: justify; color: darkslategray; @@ -27,14 +23,14 @@ div.document h6 { } div.document h1 { text-align: center; } div.document h2 { border-bottom: 1px solid; } -div.document h3 { border-bottom: 1px dotted; } +div.document h3 { border-bottom: 1px solid lightgray; } div.document table, tr, td, th { border: none; padding: 0em 0.2em 0em 0.2em; } div.document img { display: block; -/* border: 1px dotted; */ + /* border: 1px dotted; */ margin: auto; } div.document img.feed { @@ -54,7 +50,7 @@ div.document div.math img { margin: auto; } div.document code { - font-size: 14px; + font-size: 85%; padding: 1px; border: 1px solid lightgrey; background-color: aliceblue; @@ -62,26 +58,23 @@ div.document code { /* :download: role; should look like a normal link rather than inline code block */ div.document a code.download { font-family: sans; - font-size: 1em; + font-size: 100%; padding: none; border: none; background-color: transparent; } - div.footer { - margin: 0 0 0 20%; + margin: 0 0 0 360px; padding: 1em; float: right; font-style: italic; color: gainsboro; } - - div.sphinxsidebar { border-right: 1px solid darkgray; - width: 20%; + min-width: 360px; text-align: left; position: fixed; background-color: gainsboro; @@ -90,11 +83,13 @@ div.sphinxsidebar { color: midnightblue; } div.sphinxsidebar a { color: midnightblue; } -div.sphinxsidebarwrapper { padding: 1em; } +div.sphinxsidebarwrapper { + padding: 1em; +} div.sphinxsidebarwrapper ul { list-style-type: disc; padding: 0 0 0 1em; - font-size: 0.95em; + font-size: 90%; color: darkgray; } div.sphinxsidebarwrapper h1, @@ -109,20 +104,64 @@ div.sphinxsidebarwrapper h6 { div.sphinxsidebarwrapper div.re2c-logo { background-color: silver; font-family: Courier, monospace; - font-size: 1.5em; + font-size: 150%; text-align: center; border: 1px solid darkgray; overflow: hidden; } +div.re2c-toc-global { + font-size: 110%; +} div.re2c-toc-local { padding: 0.5em; background-color: linen; border: 1px solid darkgray; overflow: auto; + font-size: 110%; } - +/* searchbox */ +input[type="text"] { + font-size: 100%; + padding: 0px 5px 0px 5px; + margin: 0px; + height: 2em; + width: 80%; + border: 1px solid darkgray; + border-radius: 7px; + background-color: white; +} +input[type="submit"] { + font-size: 100%; + padding: 0px 5px 0px 5px; + margin: 0px; + height: 2em; + width: auto; + border: 1px solid darkgray; + border-radius: 7px; + font-weight: bold; + color: steelblue; + background-color: whitesmoke; +} .headerlink { display: none; } a:focus { outline: none; } + +/* move sidebar on mobile phones */ +@media (max-width: 1000px) { + div.sphinxsidebar { + position: static; + width: auto; + height: auto; + border-right: none; + border-bottom: 1px solid darkgray; + text-align: left; + } + div.document { + margin: 0; + } + body { + font-size: 20px; + } +} -- 2.40.0