Commit Graph

13 Commits

Author SHA1 Message Date
Mark Brown
d465fa53cb Update the COPYING.LIB file and references to it.
Discussion of these changes can be found on the Mercury developers
mailing list archives from June 2018.

COPYING.LIB:
    Add a special linking exception to the LGPL.

*:
    Update references to COPYING.LIB.

    Clean up some minor errors that have accumulated in copyright
    messages.
2018-06-09 17:43:12 +10:00
Zoltan Somogyi
d33273d033 Tell vim not to expand tabs in Makefiles.
This file-specific setting will override a default setting of expandtabs
in $HOME/.vimrc.

*/Makefile:
*/Mmakefile:
    As above.

tests/hard_coded/.gitignore:
    Don't ignore the purity subdir. This ignore must have been left over
    from when purity.m was a test in hard_coded, not hard_coded/purity,
    and it ignored an executable, not a directory.
2015-01-08 22:07:29 +11:00
Paul Bone
4f46d28e67 Fixes for lex_demo.m
lex_demo.m wasn't compiling because io.print_line doesn't exist.  I also
found that drawing the "> " prompt wasn't working as expected.  This patch
fixes both these issues.

extras/lex/samples/lex_demo.m:
    As above.
2014-05-19 12:49:28 +10:00
Sebastian Godelet
05745a70bb Added the times operator for regular expressions, such that one can express
/[a-z]{10}/ in this way: `Regex = range('a', 'z') * 10'.

extras/lex/lex.m:
    Removed unused and unsafe str_foldr function,
    added (T * int) = regexp function.

extras/lex/samples/lex_demo.m:
    Removed whitespace in comments,
    added an input prompt,
    added a lexeme for '//' C++ comments using the new '*' operator.
2014-05-19 11:32:39 +10:00
Paul Bone
fae91b93d3 Merge branch 'version-14_01-branch' 2014-02-27 17:01:03 +11:00
Sebastian Godelet
f9899940b7 Add .gitignore files to the extras/ directory
extras/.gitignore:
    Mercury ignores the --use-{grade}-subdir dir
    Mercury/** for git 1.8+ this recursively ignores all build files
    ignoring *.mh and *.init files
    *.err output files
    lib*.{dll|so|a|dylib} ignores target compiler library output
    *.jar ignores the Java grade output
    *.exe for Windows executables

extras/dynamic_linking/.gitignore:
    ignoring the copy of dl.m, name_mangle.m
    ignoring hello lib and dl_test* executables

extras/moose/samples/.gitignore:
    ignoring cgram.m small.m alpha.m expr.m which are
    generated from the .moo grammar files

extras/graphics/mercury_cairo/samples/.gitignore:
    ignoring *.png output and all executables

extras/**/.gitignore:
    In each sample/test/example folder the linux executable/test
    output is ignored
2014-02-27 16:58:43 +11:00
Sebastian Godelet
6ac280a7ef extras/lex: enable full Unicode support.
The NFA is now using the sparse_bitset to compile the state transitions.
This significantly reduces the compile time for the regular expression, thus
enabling the use of a much larger Unicode range for character recognition.

The helper function anybut/1 has been made aware of unicode, i.e.
anybut/1 now recognises [`0x1` .. `0xffff`] - [but chars].

In addition, the regexp(string) instance now accepts Unicode chars,
the previous code was only valid for ASCII chars (when using the UTF-8
encoded C-strings in the C-based grades)

extras/lex/lex.convert_NFA_to_DFA.m:
    Use the sparse_bitset ADT to build the tables used by the library.

extras/lex/lex.m:
    Add a new constructor to the regexp type allowing regexps to be build
    directly from character sets.

extras/lex/lex.regexp.m:
    Build regexps from character sets.

extras/lex/samples/lex_demo.m:
    Demonstrate the use of wide characters in the lexer demo.

extras/lex/lex.automata.m:
extras/lex/lex.lexeme.m:
    Conform to above changes.
2014-02-24 19:39:09 +11:00
Sebastian Godelet
25abe405f7 extras/lex improvements
+ Add a charset type that can be used to represent sets of characters.
      These are useful when constructing lexers.

    + Start adding support for wider character sets.

    + Add support for matching on ranges of characters.

extras/lex/lex.m:
    As above.

    anybut/1 now uses unicode as a basis.

extras/lex/samples/lex_demo.m:
    Demonstrate the new features.
2014-02-24 19:39:09 +11:00
Julien Fischer
7a2a7c039b Formatting and style fixes. There are no changes to any algorithms.
extras/lex/*.m:
extras/lex/README*:
	Formatting and style fixes.  There are no changes to any algorithms.
2011-01-10 04:32:26 +00:00
Ondrej Bojar
fcb00fb712 Replaced lex Mmakefile with Makefile to promote 'mmc --make' instead of
Estimated hours taken: 1
Branches: main

Replaced lex Mmakefile with Makefile to promote 'mmc --make' instead of
'mmake'. Moreover, lex installed with mmake was not usable with 'mmc --make'.

extras/lex/Makefile:
extras/lex/Mmakefile:
extras/lex/samples/Makefile:
extras/lex/samples/Mmakefile:
extras/lex/tests/Makefile:
extras/lex/tests/Mmakefile:
    Replaced each Mmakefile with a corresponding Makefile and modified/added
    rules to keep the functionality.
2007-03-02 03:55:53 +00:00
Ralph Becket
2a792e12b3 Added a new module, regex, as a companion to lex.
Estimated hours taken: 60
Branches: main

Added a new module, regex, as a companion to lex.  The new module provides
functionality for converting conventional Unix-style regular expressions
into regexps for use with lex and a number of search and search-and-replace
functions for strings.

The new functionality has been tested fairly thoroughly (and led to several
bugs in lex being identified and fixed.)

NEWS:
	Reported new additions.

extras/lex/README:
	Now just points the reader to README.lex and README.regex.

extras/lex/README.lex:
extras/lex/README.regex:
	Added.  Brief introductions to the two libraries.

extras/lex/lex.automata.m:
extras/lex/lex.buf.m:
extras/lex/lex.convert_NFA_to_DFA.m:
extras/lex/lex.regexp.m:
	Trivial formatting changes.

extras/lex/lex.lexeme.m:
	Removed the parameter on inst compiled_lexeme.

extras/lex/lex.m:
	Various formatting changes.

	Added pred offset_from_start/3 which can be used to identify
	the `current' point in the input stream with respect to lexing.

	Added pred read_char/3 which can be used to read the `next'
	char from the input stream without doing any lexing.

	Added a field init_winner_func to the lexer_instance type.  This
	is used to resolve a bug whereby regular expressions that match
	the empty string were not being spotted at the start of the input
	stream.

	Solved some bugs whereby an exception was incorrectly thrown in
	some circumstance when the end of the input stream was reached.

extras/lex/regex.m:
	Added.  This file defines the functions for converting Unix-style
	regular expression strings into regexps for use with lex and into
	regexes for use with the string search(-and-replace) predicates
	defined in this module.

extras/lex/Mmakefile:
	Improved the installation instructions and included a check target.

extras/lex/tests:
extras/lex/tests/Mmakefile:
extras/lex/tests/test_regex:
extras/lex/tests/test_regex.in:
extras/lex/tests/test_regex.exp:
	Added a test suite.

extras/lex/tests/cmp_regex_gawk:
	This program looks for differences in behaviour between gawk and
	regex.

extras/lex/samples/demo.m:
	Moved to lex_demo.m
extras/lex/samples/lex_demo.m:
	Was demo.m; slightly changed to include a match for unexpected
	characters.

extras/lex/samples/regex_demo.m:
	Added.

extras/lex/samples/Mmakefile:
	Updated.
2002-12-03 04:49:07 +00:00
Ralph Becket
6470e238ef Recovered the lost check-ins from the CVS archive, obtained and
Estimated hours taken: 1
Branches: main

Recovered the lost check-ins from the CVS archive, obtained and
applied the patches and checked that all is well.

extras/lex/Mmakefile:
extras/lex/README:
extras/lex/lex.automata.m:
extras/lex/lex.buf.m:
extras/lex/lex.convert_NFA_to_DFA.m:
extras/lex/lex.lexeme.m:
extras/lex/lex.m:
extras/lex/lex.regexp.m:
extras/lex/samples/demo.m:
	Patched to recover the lost check-in.
2001-10-04 07:46:04 +00:00
Ralph Becket
c5e6fc4e6d Added a new lexer module to extras.
Estimated hours taken: 20

Added a new lexer module to extras.

extras/lex/Mmakefile:
extras/lex/README:
extras/lex/lex.m:
extras/lex/lex.automata.m:
extras/lex/lex.buf.m:
extras/lex/lex.convert_NFA_to_DFA.m:
extras/lex/lex.lexeme.m:
extras/lex/lex.regexp.m:
extras/lex/samples:
extras/lex/samples/Mmakefile:
extras/lex/samples/demo.m:
	Added.
2001-02-21 16:29:39 +00:00