mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-21 04:13:46 +00:00
tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
Make these tests use four-space indentation, and ensure that
each module is imported on its own line. (I intend to use the latter
to figure out which subdirectories' tests can be executed in parallel.)
These changes usually move code to different lines. For the debugger tests,
specify the new line numbers in .inp files and expect them in .exp files.
57 lines
1.6 KiB
Mathematica
57 lines
1.6 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% Test the lexer reads implementation-defined literals from strings correctly.
|
|
|
|
:- module impl_def_lex_string.
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
%---------------------------------------------------------------------------%
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- implementation.
|
|
|
|
:- import_module io.
|
|
:- import_module lexer.
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
main(!IO) :-
|
|
InitialPos = posn(1, 0, 0),
|
|
|
|
string_get_token_list("$f", TokensA, InitialPos, FinalPosA),
|
|
io.write({TokensA, FinalPosA}, !IO),
|
|
io.nl(!IO),
|
|
|
|
string_get_token_list("$foo", TokensB, InitialPos, FinalPosB),
|
|
io.write({TokensB, FinalPosB}, !IO),
|
|
io.nl(!IO),
|
|
|
|
% followed by non-lowercase character
|
|
string_get_token_list("$FOO", TokensC, InitialPos, FinalPosC),
|
|
io.write({TokensC, FinalPosC}, !IO),
|
|
io.nl(!IO),
|
|
|
|
% followed by eof
|
|
string_get_token_list("$", TokensD, InitialPos, FinalPosD),
|
|
io.write({TokensD, FinalPosD}, !IO),
|
|
io.nl(!IO),
|
|
|
|
% followed by graphic character
|
|
string_get_token_list("$!$", TokensE, InitialPos, FinalPosE),
|
|
io.write({TokensE, FinalPosE}, !IO),
|
|
io.nl(!IO),
|
|
|
|
string_get_token_list("$,", TokensF, InitialPos, FinalPosF),
|
|
io.write({TokensF, FinalPosF}, !IO),
|
|
io.nl(!IO),
|
|
|
|
string_get_token_list("$0", TokensG, InitialPos, FinalPosG),
|
|
io.write({TokensG, FinalPosG}, !IO),
|
|
io.nl(!IO).
|