summaryrefslogtreecommitdiff
path: root/src/latex.ml
AgeCommit message (Collapse)Author
2020-10-07latex: Guard abbreviations with \@Jessica Clarke
Otherwise they will be typeset as if the end of a sentence, causing additional spacing after the '.' when not using \frenchspacing.
2020-09-30Merge pull request #100 from arichardson/add-more-latex-tests-and-fix-escapingAlasdair Armstrong
Add more latex tests and fix underscore escaping
2020-09-29Refactor: Change AST type from a union to a structAlasdair
2020-09-28LaTeX: Underscore-escape values in the \ifstrequal codeAlex Richardson
2020-09-28LaTeX: provide default implementations of the other saildoc commandsAlex Richardson
2020-09-28Move the ast defs wrapper into it's own fileAlasdair
This refactoring is intended to allow this type to have more than just a list of definitions in future.
2020-09-28Merge pull request #98 from arichardson/add-sectioning-commandsAlasdair Armstrong
Handle sectioning commands in saildoc LaTeX output
2020-09-28LaTeX: Add newline after itemize and enumerate environmentsAlex Richardson
2020-09-28Handle sectioning commands in saildoc LaTeX outputAlex Richardson
2020-09-27latex: Prefix label names with the specified -latex_prefixJessica Clarke
This ensures names shared between multiple projects don't collide if included in a common LaTeX document; cheri-architecture using both sail-cheri-mips and sail-cheri-riscv runs into this. Closes: #88
2020-09-27latex: Prepend opt_prefix inside latex_cat_idJessica Clarke
Now that the category is prepended in latex_cat_id, also prepend opt_prefix there instead to ensure no caller forgets to do so. No functional change intended, and verified by regenerating the LaTeX for sail-cheri-mips and sail-cheri-riscv.
2020-09-27latex: Refactor category name prefixingJessica Clarke
Rather than having the caller prefix latex and refcode strings with the category, push that down into common functions to both abstract away the details and avoid duplication. No functional change intended, and verified by regenerating the LaTeX for sail-cheri-mips and sail-cheri-riscv.
2020-09-27latex: Remove unused latex_label functionJessica Clarke
2020-09-25Saildoc: do not mangle links targets enclosed in <>Alex Richardson
This can be useful to reference things that aren't defined by sail.
2020-09-24Wrap saildoc LaTeX in \saildoclabelled macroJessica Clarke
This takes two arguments: the label name and the \saildocfoo macro use itself. This allows cunning definitions of \saildoclabelled and \saildocfoo to tease apart the various bits and reconstruct them in a different order without having to redefine \phantomsection and \label temporarily and hard-code knowledge of the implementation of these documentation commands. I intend to use these in cheri-architecture in combination with sail-cheri-riscv. Unlike the other macros, this is considered a bit more niche, so we include a default definition of it that expands to what was previously hard-coded. This also makes this a non-breaking change.
2020-09-21latex: Handle Ulp, Ol and Olp markdown constructsJessica Clarke
2020-09-21latex: Dump out S-Expr of any unhandled markdownJessica Clarke
Printing the text is only so helpful; the most important thing to know is what kind of element it actually is, which is lost when extracting the text. Instead, print the whole S-Expr.
2019-05-22Move Util.warn to Reporting, and make it take the location as a parameterAlasdair Armstrong
Also add a $suppress_warnings directive that ensures that no warnings are generated for a specific file.
2019-04-05Lem: Make generated assertion messages look nicer in prover outputAlasdair
Add a new short_loc_to_string function that produces just the file and line number as a single line. loc_to_string adds a bunch of terminal color codes and other formatting designed for producing pretty error-messages in the terminal, which isn't ideal when the string appears in prover output as part of an assert statement. This is should be purely an aesthetic change.
2019-02-18Fix latex outputAlasdair Armstrong
Fixes #33
2019-01-29Merge branch 'sail2' into asl_flow2Thomas Bauereiss
2019-01-21Fix some issues with latex generation so manual builds againAlasdair Armstrong
since riscv is no longer in this repository, and we use the RISC-V duopod as an example, you need to build as: make RISCV=directory manual.pdf if directory is not equal to ../../sail-riscv (which is where it would be if sail and sail-riscv are checked out in the same respository together)
2019-01-16Latex: handle underscores when generating latex names.Prashanth Mundkur
2018-11-15Add simple valspec printing in latex that drops effects and other extraneous ↵Robert Norton
details (TODO make this optional).
2018-11-14Use code style For [id] refs in doc comments.Robert Norton
2018-11-14latex: use callback macro saildocxxx (one per top-level category) to give ↵Robert Norton
usere more flexibility about formatting generated latex.
2018-11-12Add referencing commands to generated latexAlasdair Armstrong
2018-11-12Fix numbers in constructor argumentsAlasdair Armstrong
Also ensure no collisions for function clause constructor categories
2018-11-12Improve latex naming scheme and avoid collisionsAlasdair Armstrong
2018-11-09Improvements to latex generationAlasdair Armstrong
The main changes so far are: * Allow markdown formatting in doc comments. We parse the markdown using Omd, which is a OCaml library for parsing markdown. The nice thing about this library is it's pure OCaml and has no dependencies other the the stdlib. Incidentally it was also developed at OCaml labs. Using markdown keeps our doc-comments from becoming latex specfic, and having an actual parser is _much_ nicer than trying to hackily process latex in doc-comments using OCamls somewhat sub-par regex support. * More sane conversion latex identifiers the main approach is to convert Sail identifiers to lowerCamelCase, replacing numbers with words, and then add a 'category' code based on the type of identifier, so for a function we'd have fnlowerCamelCase and for type synonym typelowerCamelCase etc. Because this transformation is non-injective we keep track of identifiers we've generated so we end up with identifierA, identifierB, identifierC when there are collisions. * Because we parse markdown in doc comments doc comments can use Sail identifiers directly in hyperlinks, without having to care about how they are name-mangled down into TeX compatible things. * Allow directives to be passed through the compiler to backends. There are various $latex directives that modify the latex output. Most usefully there's a $latex newcommand name markdown directive that uses the markdown parser to generate latex commands. An example of why this is useful is bellow. We can also use $latex noref id To suppress automatically inserting links to an identifier * Refactor the latex generator to make the overall generation process cleaner * Work around the fact that some operating systems consider case-sensitive file names to be a good thing * Fix a bug where latex generation wouldn't occur unless the directory specified by -o didn't exist This isn't quite all the requested features for good CHERI documentation, but new features should be much easier to add now.
2018-10-31Rename Reporting_basic to ReportingAlasdair Armstrong
There is no Reporting_complex, so it's not clear what the basic is intended to signify anyway. Add a GitHub issue link to any err_unreachable errors (as they are all bugs)
2018-09-12Jenkins: Fix deprecation warningsAlasdair Armstrong
Now that Jenkins is updated to a newer version of OCaml we can finally fix some warning with more recent versions of OCaml than 4.02.3. Also fix a Lem test case that was failing.
2018-08-07Revert "Warnings: deal with all the deprecation warnings"Alasdair Armstrong
One day we will be free from the 4.02.3 menace, but today is not that day. :( This should fix Sail on Jenkins This reverts commit 86e29bcbb1597c4ef1f6cae8edbeed42f9a31414.
2018-07-26Warnings: deal with all the deprecation warningsAlastair Reid
Changes are: - String.capitalize -> String.capitalize_ascii - String.uppercase -> String.uppercase_ascii - String.lowercase -> String.lowercase_ascii Basically just making the change that the warning message suggested.
2018-05-11Remove unneeded _sail suffix from latex files.Robert Norton
2018-05-11Avoid generating latex files that differ only by case because this causes ↵Robert Norton
confusion on case insensitive file systems (e.g. mac).
2018-05-10latex: don't include the prefix in the label. This means we have the option ↵Robert Norton
of omitting valspec in documentation if it is deemed too verbose and still have hyperlinks work. The caveat is that it could result in multiply defined labels.
2018-05-09Add language=sail option in listings command for latex output. This helps ↵Robert Norton
with documents containing listings in multiple languages.
2018-04-25Start working on documentationAlasdair Armstrong
2018-04-23Merge branch 'rmn30_latex' into sail2Robert Norton
2018-04-18add some experimental support for latex output in multiple files.Robert Norton
2018-04-18Updates to latex mode for documentationAlasdair Armstrong
2018-04-05Fix precedence printing and update aarch64 specAlasdair Armstrong
More work on Latex output
2018-04-05More work on latex outputAlasdair Armstrong
Now generate commands for each toplevel definition, such that e.g. the function clause for execute LOAD could be inserted using \sailexecuteLOAD. Tries to generate fairly intuitive names while avoiding clashes where possible.
2018-03-19Fixes to C backend for RISCV-compilationAlasdair Armstrong
Can now compile RISCV. Requires some library tweaks before it'll pass any tests, Also adds hyperlinks to wip latex output
2018-03-14WIP Latex formattingAlasdair Armstrong
Added option -latex that outputs input to a latex document. Added doc comments that can be attached to certain AST nodes - right now just valspecs and function clauses, e.g. /*! Documentation for main */ val main : unit -> unit These comments are kept by the sail pretty printer, and used when generating latex