Commit graph

88 commits

Author SHA1 Message Date
Leonardo de Moura
c862ce4a75 feat(runtime, library/init/data/string/basic): add utf8_pos
`utf8_pos` is a low level alternative for `string.iterator`.
TODO: implement `string.iterator` using it.
2019-03-09 12:30:19 -08:00
Leonardo de Moura
8ee2f4fea1 feat(*): basic runtime string support 2018-05-14 16:52:55 -07:00
Leonardo de Moura
0556412f8d refactor(*): add runtime folder
@kha The runtime folder includes what is needed to link a
standalone Lean program. It is still contains some unnecessary files.
We will be able to remove them after we release Lean4.
2018-05-14 14:23:56 -07:00
Leonardo de Moura
d2497d554f feat(frontends/lean): add support for unicode char literals and escape sequences
TODO: we are not checking if the unicode escape values provide by the
user correspond to valud unicode scalar values. We should check how
other languanges handle this case.
2017-10-23 13:46:57 -07:00
Sebastian Ullrich
c44ed73d56 fix(frontends/lean/scanner): minor lexical grammar fixup 2017-07-26 17:02:00 +02:00
Sebastian Ullrich
f53fa97c4a feat(frontends/lean): escape identifiers when pretty-printing 2017-06-28 10:43:19 -07:00
Sebastian Ullrich
16fe494736 feat(frontends/lean/scanner): accept arbitrary escaped identifiers 2017-06-28 10:43:19 -07:00
Gabriel Ebner
ed27334557 refactor(frontends/lean/scanner): use uchar for scanning 2017-06-25 10:06:29 +02:00
Gabriel Ebner
95f8a50a03 fix(frontends/lean/scanner): use platform-independent end-of-file marker 2017-06-19 10:39:08 +02:00
Sebastian Ullrich
56995348d3 hack(frontends/lean/parser): allow input to be substituted and use it to implement interpolating format macro 2017-06-07 10:09:38 -07:00
Gabriel Ebner
b1e417805e fix(frontends/lean/scanner): do not treat 0xFF as end-of-file
Fixes #1624.  We just replace 0xFF by 0x00 when reading a new input
byte.  This shows up as an unexpected token error.
2017-05-31 16:54:04 +02:00
Sebastian Ullrich
5a19430f60 fix(frontends/lean/scanner): wrong upos after field projection 2017-05-23 10:33:31 +02:00
Sebastian Ullrich
818c041922 fix(frontends/lean/scanner): skip_to_pos was skipping bytes instead of chars 2017-05-14 19:19:22 -07:00
Leonardo de Moura
a0a8103804 chore(frontends/lean): go back to 'c' as notation for characters
This suggestion has been discussed at Slack.
We have decided to use #"c" as notation because we wanted to allow `'`
in the beginning of identifiers like in SML and F*. In particular,
we wanted to allow users to use 'a 'b 'c for naming type parameters
like in SML. However, nobody used this notation. In the Lean standard
library, we are using greek letters for naming type parameters.
So, there is no real motivation for the ugly #"c" syntax.
2017-05-02 13:00:51 -07:00
Leonardo de Moura
f64b3cb874 chore(frontends/lean): do not allow identifiers starting with ' 2017-05-02 10:43:44 -07:00
Gabriel Ebner
cde946f293 fix(frontends/lean/scanner): fix assertion 2017-04-01 16:38:02 +02:00
Leonardo de Moura
b7c3d5a9f5 fix(frontends/lean/scanner): assertion 2017-03-31 19:39:13 -07:00
Gabriel Ebner
f9c1ceb717 fix(frontends/lean/scanner): correctly handle positions in empty files 2017-03-31 09:40:15 -07:00
Leonardo de Moura
71685e4dd6 feat(frontends/lean): add support for t.<id> and t.<idx> when t is a composite term
Replace `^.` with `.` in the stdlib
2017-03-28 17:47:49 -07:00
Gabriel Ebner
318910f99b refactor(frontends/lean/parser): store snapshots in a lazy async list 2017-03-27 14:00:53 -07:00
Gabriel Ebner
c55579dd69 fix(frontends/lean/scanner): initialize m_pos 2017-03-24 07:04:35 +01:00
Sebastian Ullrich
9d8c84713c refactor(*): reduce exception context info from expr to pos_info 2017-02-17 13:45:57 +01:00
Leonardo de Moura
01414cf21c feat(frontends/lean): add token class, and procedure for consuming the tokens 2017-02-03 18:11:06 -08:00
Sebastian Ullrich
222952d5b8 chore(frontends/lean/scanner): another CLion fix 2017-01-13 07:34:54 -08:00
Leonardo de Moura
df91ae3738 fix(library/string,library/init/data/to_string): handle ASCII control characters 2017-01-11 23:44:33 -08:00
Leonardo de Moura
97dd2f34d5 feat(library,frontends/lean): add basic doc string support 2016-11-25 18:52:56 -08:00
Leonardo de Moura
d59bf05f20 feat(frontends/lean/scanner): allow ' in the beginning of identifiers 2016-11-17 11:53:21 -08:00
Leonardo de Moura
dfd2a23cd4 feat(frontends/lean): use #"c" instead of 'c' for character literals
The new notation is the same one used in Standard ML.
It will also allow us to use ' in the beginning of identifiers like Standard ML.
2016-11-17 11:35:54 -08:00
Joe Hendrix
8ceada5555 feat(frontends/lean): support binary, octal and hex literals
Scanner will interpret numeric literals prefixed with '0b', '0o', and
'0x' as binary, octal, and hex decimal values respectively.  The prefix
character ('b', 'o', 'x') may be upper or lower case.
2016-10-19 10:13:24 -07:00
Gabriel Ebner
8c188c59c5 feat(frontends/lean): remember column for snapshots 2016-10-13 18:49:10 -07:00
Leonardo de Moura
59ff0eef5c feat(frontends/lean/scanner): hexadecimal numerals 2016-07-19 13:04:27 -04:00
Leonardo de Moura
492c90ed1d feat(frontends/lean/scanner): hex scape in character literal 2016-07-19 12:38:20 -04:00
Leonardo de Moura
3218f91e35 feat(frontends/lean): add support for character literals 2016-07-18 14:07:10 -04:00
Leonardo de Moura
3996f9db4d feat(frontends/lean): add ( token and remove token 2016-06-15 13:22:31 -07:00
Leonardo de Moura
9cbda49297 chore(frontends/lean): remove script blocks 2016-02-11 17:26:44 -08:00
Leonardo de Moura
4821af8685 feat(frontends/lean/scanner): disallow superscripts in identifiers
See new test for motivating example.
2016-01-26 18:46:40 -08:00
Sebastian Ullrich
dbfebd5409 feat(frontends/lean/scanner): add more checks to read_quoted_symbol 2015-10-13 09:52:35 -07:00
Leonardo de Moura
c9af007994 chore(frontends/lean): fix style 2015-09-30 17:40:35 -07:00
Sebastian Ullrich
da08079af9 feat(frontends/lean): allow specifying notation spacing via quoted symbols
Unquoted tokens inherit their spacing from the respective reserved definition.
2015-09-30 17:36:32 -07:00
Sebastian Ullrich
189a300b11 feat(frontends/lean): improve pretty printing space insertion heuristic 2015-09-30 17:36:32 -07:00
Leonardo de Moura
b9451549d1 feat(frontends/lean): add type notation for referencing hypotheses 2015-07-20 21:43:47 -07:00
Leonardo de Moura
01f8f3c11d fix(frontends/lean): memory access violation 2015-06-14 15:37:45 -07:00
Leonardo de Moura
0502f46f9b fix(frontends/lean/scanner): another bug related to issue #626 2015-05-26 13:39:42 -07:00
Leonardo de Moura
25e41b9b09 fix(frontends/lean/scanner): fixes #626 2015-05-26 11:33:38 -07:00
Leonardo de Moura
cbcaf5a48e fix(frontends/lean/scanner): block comments
fixes #600
2015-05-13 22:14:28 -07:00
Leonardo de Moura
033f3b630d feat(frontends/lean/scanner): allow upper-case greek letters in identifiers but Pi and Sigma 2015-03-30 02:14:26 -07:00
Leonardo de Moura
ce889ddf60 feat(frontends/lean/scanner): disallow hierarchical names such as 'x.1' 2014-11-09 12:55:13 -08:00
Leonardo de Moura
469368f090 refactor(frontends/lean/scanner): move basic UTF8 procedures to separate module 2014-10-19 13:29:15 -07:00
Leonardo de Moura
29d6bff785 refactor(frontends/lean): explicit initialization/finalization 2014-09-23 10:00:36 -07:00
Leonardo de Moura
b3e05a2fe9 refactor(frontends/lean/scanner): remove dependency to seekg and unget
methods

It is not safe to use seekg for textual files. Here is a fragment from a
C++ manual:

seekg() and seekp()

This pair of functions serve respectively to change the position of stream pointers get and put. Both functions are overloaded with two different prototypes:

     seekg ( pos_type position );
     seekp ( pos_type position );

Using this prototype the stream pointer is changed to an absolute position from the beginning of the file. The type required is the same as that returned by functions tellg and tellp.

      seekg ( off_type offset, seekdir direction );
      seekp ( off_type offset, seekdir direction );

Using this prototype, an offset from a concrete point determined by
parameter direction can be specified. It can be:

          ios::beg	offset specified from the beginning of the stream
          ios::cur	offset specified from the current position of the stream pointer
          ios::end	offset specified from the end of the stream

The values of both stream pointers get and put are counted in different
ways for text files than for binary files, since in text mode files some
modifications to the appearance of some special characters can
occur. For that reason it is advisable to use only the first prototype
of seekg and seekp with files opened in text mode and always use
non-modified values returned by tellg or tellp. With binary files, you
can freely use all the implementations for these functions. They should
not have any unexpected behavior.
2014-09-18 15:24:48 -07:00