xo-reader: + docs scaffold
This commit is contained in:
parent
0adba354f1
commit
a0b6a85297
8 changed files with 151 additions and 3 deletions
|
|
@ -19,9 +19,12 @@ add_definitions(${PROJECT_CXX_FLAGS})
|
|||
# ----------------------------------------------------------------
|
||||
|
||||
add_subdirectory(src/reader)
|
||||
add_subdirectory(examples)
|
||||
add_subdirectory(utest)
|
||||
xo_export_cmake_config(${PROJECT_NAME} ${PROJECT_VERSION} ${PROJECT_NAME}Targets)
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# provide find_package() support
|
||||
|
||||
xo_export_cmake_config(${PROJECT_NAME} ${PROJECT_VERSION} ${PROJECT_NAME}Targets)
|
||||
# docs targets depends on other library/utest/exec targets,
|
||||
# must come after them
|
||||
#
|
||||
add_subdirectory(docs)
|
||||
|
|
|
|||
7
docs/CMakeLists.txt
Normal file
7
docs/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# xo-reader/docs/CMakeLists.txt
|
||||
|
||||
xo_doxygen_collect_deps()
|
||||
xo_docdir_doxygen_config()
|
||||
xo_docdir_sphinx_config(
|
||||
index.rst
|
||||
)
|
||||
41
docs/README
Normal file
41
docs/README
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
standalone build
|
||||
|
||||
+-----------------------------------------------+
|
||||
| cmake |
|
||||
| CMakeLists.txt |
|
||||
| $PREFIX/share/cmake/xo_macros/xo_cxx.cmake |
|
||||
+-----------------------------------------------+
|
||||
|
|
||||
| +----------------------+
|
||||
+------------------------------------------------->| .build/docs/Doxyfile |
|
||||
| +----------------------+
|
||||
| ^
|
||||
| (cmake |
|
||||
| /------------/
|
||||
| |
|
||||
| +---------------------------------------+ +-----------------+
|
||||
+---->| doxygen |--->| .build/docs/dox |
|
||||
| | $PREFIX/share/xo-macros/Doxyfile.in | | +- html/ |
|
||||
| +---------------------------------------+ | +- xml/ |
|
||||
| +-----------------+
|
||||
| |
|
||||
| /------------/
|
||||
| |
|
||||
| v
|
||||
| +---------------------------------------+ +--------------------+
|
||||
\---->| sphinx |--->| .build/docs/sphinx |
|
||||
| +- conf.py | | +- html/ |
|
||||
| +- _static/ | +--------------------+
|
||||
| +- *.rst |
|
||||
+---------------------------------------+
|
||||
|
||||
umbrella build relies on top-level cmake macros
|
||||
|
||||
files
|
||||
|
||||
README this file
|
||||
CMakeLists.txt build entry point
|
||||
conf.py sphinx config
|
||||
_static static files for sphinx
|
||||
|
||||
index.rst toplevel sphinx document; entry point
|
||||
1
docs/_static/README
vendored
Normal file
1
docs/_static/README
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
add any static {.html, .js, ..} files for sphinx to pickup here
|
||||
BIN
docs/_static/img/favicon.ico
vendored
Normal file
BIN
docs/_static/img/favicon.ico
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 302 KiB |
39
docs/conf.py
Normal file
39
docs/conf.py
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# Configuration file for the Sphinx documentation builder.
|
||||
#
|
||||
# For the full list of built-in configuration values, see the documentation:
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
||||
|
||||
# -- Project information -----------------------------------------------------
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
||||
|
||||
project = 'xo reader documentation'
|
||||
copyright = '2024-2025, Roland Conybeare'
|
||||
author = 'Roland Conybeare'
|
||||
|
||||
# -- General configuration ---------------------------------------------------
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
||||
|
||||
#extensions = []
|
||||
extensions = [ "breathe",
|
||||
"sphinx.ext.mathjax", # inline math
|
||||
"sphinx.ext.autodoc", # generate info from docstrings
|
||||
"sphinxcontrib.ditaa", # diagrams-through-ascii-art
|
||||
"sphinxcontrib.plantuml" # text -> uml diagrams
|
||||
]
|
||||
|
||||
# note: breathe requires doxygen xml output -> must have GENERATE_XML = YES in Doxyfile.in
|
||||
# match project name in Doxyfile.in
|
||||
breathe_default_project = "xodoxxml"
|
||||
|
||||
templates_path = ['_templates']
|
||||
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
||||
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# -- Options for HTML output -------------------------------------------------
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
||||
|
||||
#html_theme = 'alabaster'
|
||||
html_theme = 'sphinx_rtd_theme'
|
||||
html_static_path = ['_static']
|
||||
html_favicon = '_static/img/favicon.ico'
|
||||
45
docs/example.rst
Normal file
45
docs/example.rst
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
.. _examples:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
Examples
|
||||
========
|
||||
|
||||
See ``xo-reader/examples`` for built examples
|
||||
|
||||
.. code-block:: cpp
|
||||
:linenos:
|
||||
|
||||
#include "xo/reader/reader.h"
|
||||
|
||||
int
|
||||
main() {
|
||||
using namespace xo::scm;
|
||||
using namespace std;
|
||||
|
||||
reader rdr;
|
||||
rdr.begin_translation_unit();
|
||||
|
||||
bool eof = false;
|
||||
while (!eof) {
|
||||
auto input = ins.read_some();
|
||||
|
||||
eof = ins.eof();
|
||||
|
||||
for (auto rem = input; !rem.empty();) {
|
||||
// res: (parsed-expr, used)
|
||||
auto [expr, rem2] = rdr.read_expr(rem, eof);
|
||||
|
||||
if (expr) {
|
||||
cout << expr << endl;
|
||||
}
|
||||
|
||||
rem = rem.suffix_after(rem2);
|
||||
}
|
||||
}
|
||||
|
||||
if (rdr.has_prefix()) {
|
||||
cout << "error: unparsed input after expression" << endl;
|
||||
}
|
||||
}
|
||||
12
docs/index.rst
Normal file
12
docs/index.rst
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
.. xo-reader documentation master file.
|
||||
|
||||
xo-reader documentation
|
||||
=======================
|
||||
|
||||
xo-reader provides a parser for the Schematika language.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:caption: xo-reader contents
|
||||
|
||||
example
|
||||
Loading…
Add table
Add a link
Reference in a new issue