Commit Graph

4 Commits

Author SHA1 Message Date
Zoltan Somogyi
479838f667 Update the programming style of extras/lex. 2019-09-29 13:51:13 +10: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