aboutsummaryrefslogtreecommitdiff
path: root/parsing/cLexer.ml4
AgeCommit message (Collapse)Author
2018-10-18Removing the Camlp5 macros from CLexer.Pierre-Marie Pédrot
We partially hand-translated so as to result in the minimal diff possible.
2018-10-06[api] Remove (most) 8.9 deprecated objects.Emilio Jesus Gallego Arias
A few of them will be of help for future cleanups. We have spared the stuff in `Names` due to bad organization of this module following the split from `Term`, which really difficult things removing the constructors.
2018-03-05Merge PR #6855: Update headers following #6543.Maxime Dénès
2018-02-28[toplevel] Move beautify to its own pass.Emilio Jesus Gallego Arias
We first load the file, then we print it as a post-processing step. This is both more flexible and clearer. We also refactor the comments handling to minimize the logic that is living in the Lexer. Indeed, the main API is now living in the printer, and complex interactions with the state are not possible anymore, including the removal of messing with low-level summary and state setting!
2018-02-27Update headers following #6543.Théo Zimmermann
2018-02-22Rename release_lexer_state to the more descriptive get_lexer_state.Jim Fehrle
2017-10-05Distinguishing pseudo-letters out of the set of unicode letters.Hugo Herbelin
This includes _ and insecable space which can be used in idents and this allows more precise heuristics.
2017-09-14Using an algebraic type for distinguishing toplevel input from location in file.Hugo Herbelin
2017-08-01[flags] Remove XML output flag.Emilio Jesus Gallego Arias
This is a second try at removing the hooks for the legacy xml export system which can't currently be tested. It is also not included in the API, so it should either be included in it or this PR be applied.
2017-07-04Bump year in headers.Pierre-Marie Pédrot
2017-04-27Remove unused constructorsGaetan Gilbert
2017-04-27Remove some unused values and typesGaetan Gilbert
2017-04-27Fix omitted labels in function callsGaetan Gilbert
2017-04-07[camlpX] Remove camlp4 compat layer.Emilio Jesus Gallego Arias
We remove the camlp4 compatibility layer, and try to clean up most structures. `parsing/compat` is gone. We added some documentation to the lexer/parser interfaces that are often obscured by module includes.
2017-03-21[pp] Remove special tag type and handler from Pp.Emilio Jesus Gallego Arias
For legacy reasons, pretty printing required to provide a "tag" interpretation function `pp_tag`. However such function was not of much use as the backends (richpp and terminal) hooked at the `Format.tag` level. We thus remove this unused indirection layer and annotate expressions with their `Format` tags. This is a step towards moving the last bit of terminal code out of the core system.
2017-03-21[pp] Replace `Pp.Tag` by `Ppstyle.tag` = `string list`Emilio Jesus Gallego Arias
This is what has always been used, so it doesn't represent a functional change. This is just a preliminary patch, but many more possibilities could be done wrt tags.
2017-03-14[safe-string] parsing/cLexerEmilio Jesus Gallego Arias
No functional change.
2016-12-07Merge branch 'v8.6'Pierre-Marie Pédrot
2016-12-02Fixing lexing of strings in comments for beautifier.Hugo Herbelin
Was a bug introduced in 0ad6edc1.
2016-11-18Merge branch 'v8.6'Pierre-Marie Pédrot
2016-11-05Removing obsolete parsing of strings à la v7 in comments.Hugo Herbelin
This was for the translator and is not relevant for the beautifier.
2016-10-29Merge branch 'v8.6'Pierre-Marie Pédrot
2016-10-28Merge remote-tracking branch 'github/pr/319' into v8.6Maxime Dénès
Was PR#319: More error tagging, try to fix bug 5135
2016-10-24Merge branch 'v8.6'Pierre-Marie Pédrot
2016-10-24Merge branch 'v8.5' into v8.6Hugo Herbelin
+ a few improvements on 5f1dd4c40 (lexing of { and }).
2016-10-21Adding a primitive to recover the set of keywords from the lexer.Pierre-Marie Pédrot
This is useful for debugging purposes.
2016-10-18[pp] Add tagging function to all low-level printing calls.Emilio Jesus Gallego Arias
The current tag system in `Pp` is generic, which implies we must choose a tagging function when calling a printer. For console printing there is a single choice, thus this commits adds it a few missing cases.
2016-10-18Merge branch 'v8.6'Pierre-Marie Pédrot
2016-10-17Extra warning about unicode character of unknown status following an ident.Hugo Herbelin
This covers the case e.g. of "xₚ" (until the table of unicode characters is upgraded!).
2016-10-17Fixing a few other inconsistencies with notations.Hugo Herbelin
`Notation ".a" := nat.' was accepted and used for printing but not recognized in parsing. Now it does. Other examples in test-suite.
2016-10-17Stopping warning on unrecognized unicode character in notation (fixing #5136).Hugo Herbelin
The warning was pointless since the notation was accepted and parsed anyway. We now treat unrecognized unicode characters like ordinary undefined tokens (e.g. "#" in a bare Coq). For instance, "aₚ", or ".ₚ", or "?ₚ" now fail with "Undefined token" rather than "Unsupported Unicode character".
2016-10-17[toplevel] Remove duplicate beautify flags.Emilio Jesus Gallego Arias
Given the current style in flags.mli no reason to have a function. A deeper question is why a global flag is needed, in particular the use in `interp/constrextern.ml` seems strange, the condition in the lexer should be looked at and I'm not sure about `printing/`.
2016-10-17More on making the lexer more functional (continuing b8ae2de5 andHugo Herbelin
8a8caba3). - Adding cLexer.current_file to the lexer state, i.e. making it a component of the type "coq_parsable" of lexer state (it was forgotten in b8ae2de5 and 8a8caba3). - Inlining save_translator/restore_translator which have now lost most of their substance.
2016-10-17Removing export of location_table outside of cLexer.Hugo Herbelin
It was not used any more by coqdoc since b8194b22 (Dec 2010). The table is now only part of the lexer function closure (and only in the camlp5 case).
2016-10-12Merge branch 'v8.6'Pierre-Marie Pédrot
2016-10-09Moving Pp.comments to CLexer so that Pp is purer (no more side-effectHugo Herbelin
done by the Ppcmd_comment token) and so that lexing/parsing side-effects are collected at the same place, i.e. in CLexer.
2016-10-09Attaching all extra imperative components of the lexer/parser state toHugo Herbelin
the state of parsable streams, so that different lexing/parsing processes can be started independently without conflicting. Note however that these different lexing/parsing processes cannot be run concurrently as they still work on the same piece of global memory (i.e. calls to entry_parse should remain atomic). To go further, one would typically need to be able to functionally pass the lexing state to each call to the lexer. Note that currently the beautifier is also running in the context of a lexer/parser state (for the mapping of location to comments). In particular, this fixes #5102 (parsing/lexing of bullets depending on the lexing state which was global).
2016-10-05Merge branch 'v8.6'Pierre-Marie Pédrot
2016-10-05Revert "Move bullet detection from lexer to parser (bug #5102)."Guillaume Melquiond
This reverts commit 466b7e69e49a5f4bba36b834a2e046f120ece07c.
2016-10-02Merge branch 'v8.6'Pierre-Marie Pédrot
2016-10-02Move bullet detection from lexer to parser (bug #5102).Guillaume Melquiond
That way, bullet detection no longer depends on a global variable indicating whether a line is starting. This causes a small change in the recognized language. Before the commit, "--++" was recognized as a bullet "--" followed by a keyword "++" when at the start of a line; now it is always recognized as a keyword "--++". This also fixes a bug in Tok.to_string as a side-effect.
2016-09-08Merge PR #244.Pierre-Marie Pédrot
2016-08-30Fix #4941 - ~/.coqrc file confusing locationsMaxime Dénès
2016-08-19Unify location handling of error functions.Emilio Jesus Gallego Arias
In some cases prior to this patch, there were two cases for the same error function, one taking a location, the other not. We unify them by using an option parameter, in the line with recent changes in warnings and feedback. This implies a bit of clean up in some places, but more importantly, is the preparation for subsequent patches making `Loc.location` opaque, change that could be use to improve modularity and allow a more functional implementation strategy --- for example --- of the beautifier.
2016-07-03Remove lexing of ordinal notations.Maxime Dénès
This was implemented in anticipation of a part of PR#164 that we decided not to merge.
2016-06-29A new infrastructure for warnings.Maxime Dénès
On the user side, coqtop and coqc take a list of warning names or categories after -w. No prefix means activate the warning, a "-" prefix means deactivate it, and "+" means turn the warning into an error. Special categories include "all", and "default" which contains the warnings enabled by default. We also provide a vernacular Set Warnings which takes the same flags as argument. Note that coqc now prints warnings. The name and category of a warning are printed with the warning itself. On the developer side, Feedback.msg_warning is still accessible, but the recommended way to print a warning is in two steps: 1) create it by: let warn_my_warning = CWarnings.create ~name:"my-warning" ~category:"my-category" (fun args -> Pp.strbrk ...) 2) print it by: warn_my_warning args
2016-06-20Add file name, line number and beginning of line position to locations.Maxime Dénès
Coq locations already had support for this, but were containing dummy information. We now don't need anymore to reconstruct this information by browsing the file when printing an error message or enriching exceptions on the fly. It also became easier to interface with Coq since locations emitted by the lexer now always contain full information. On the API side, Loc.represent disappeared and Loc.t is now exposed as record. It is less error-prone than manipulating a tuple of 5 integers. Also, Loc.create takes 5 arguments instead of 3 and a pair.
2016-05-31Feedback cleanupEmilio Jesus Gallego Arias
This patch splits pretty printing representation from IO operations. - `Pp` is kept in charge of the abstract pretty printing representation. - The `Feedback` module provides interface for doing printing IO. The patch continues work initiated for 8.5 and has the following effects: - The following functions in `Pp`: `pp`, `ppnl`, `pperr`, `pperrnl`, `pperr_flush`, `pp_flush`, `flush_all`, `msg`, `msgnl`, `msgerr`, `msgerrnl`, `message` are removed. `Feedback.msg_*` functions must be used instead. - Feedback provides different backends to handle output, currently, `stdout`, `emacs` and CoqIDE backends are provided. - Clients cannot specify flush policy anymore, thus `pp_flush` et al are gone. - `Feedback.feedback` takes an `edit_or_state_id` instead of the old mix. Lightly tested: Test-suite passes, Proof General and CoqIDE seem to work.
2016-05-09Merge branch 'v8.5'Pierre-Marie Pédrot
2016-05-09Rename Lexer -> CLexer.Pierre-Marie Pédrot