mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 09:23:44 +00:00
library/mercury_term_lexer.m:
library/mercury_term_parser.m:
As above.
NEWS:
Announce the change.
browser/interactive_query.m:
compiler/analysis.file.m:
compiler/fact_table.m:
compiler/make.module_dep_file.m:
compiler/parse_module.m:
compiler/parse_tree_out_term.m:
compiler/recompilation.used_file.m:
library/MODULES_DOC:
library/char.m:
library/integer.m:
library/io.m:
library/library.m:
library/ops.m:
library/term.m:
library/term_io.m:
mdbcomp/trace_counts.m:
tests/hard_coded/impl_def_lex.m:
tests/hard_coded/impl_def_lex_string.m:
tests/hard_coded/lco_pack_args_3.m:
tests/hard_coded/lexer_bigint.m:
tests/hard_coded/lexer_ints.m:
tests/hard_coded/lexer_zero.m:
tests/hard_coded/parse_number_from_string.m:
tests/valid_seq/nested_module_bug.m:
Conform to the change.
54 lines
1.5 KiB
Mathematica
54 lines
1.5 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module lexer_bigint.
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- implementation.
|
|
|
|
:- import_module list.
|
|
:- import_module mercury_term_lexer.
|
|
:- import_module string.
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
main(!IO) :-
|
|
% Read from the current input stream.
|
|
mercury_term_lexer.get_token_list(Tokens, !IO),
|
|
write_token_list(Tokens, !IO),
|
|
io.nl(!IO),
|
|
|
|
% Read from a string.
|
|
io.open_input("lexer_bigint.inp", OpenRes, !IO),
|
|
(
|
|
OpenRes = ok(Stream),
|
|
io.read_file_as_string(Stream, ReadRes, !IO),
|
|
(
|
|
ReadRes = ok(String),
|
|
Posn0 = posn(1, 0, 0),
|
|
mercury_term_lexer.string_get_token_list(String, StringTokens,
|
|
Posn0, _Posn),
|
|
write_token_list(StringTokens, !IO)
|
|
;
|
|
ReadRes = error(_, Error),
|
|
io.write_line(Error, !IO)
|
|
)
|
|
;
|
|
OpenRes = error(Error),
|
|
io.write_line(Error, !IO)
|
|
).
|
|
|
|
:- pred write_token_list(token_list::in, io::di, io::uo) is det.
|
|
|
|
write_token_list(token_nil, !IO).
|
|
write_token_list(token_cons(Token, _Context, List), !IO) :-
|
|
io.write_line(Token, !IO),
|
|
write_token_list(List, !IO).
|