1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
patc v1.1b -- a little tool to convert patterns
Introduction
------------
patc uses a patfile, in which a set of patterns is specified,
to chance patterns in the input to other patterns in the output, especially
usefull if you want to chance from different transcriptions.
Usage
-----
patc [-v] [-p patfile] infile outfile
-v verbose mode
default patfile: "patc.pat"
patc is a pattern conversion tool, that changes patterns in the input
into other patterns in the output. It is specificly made for entering
foreign scripts in transcriptions. patc can handle several sets of patterns
in a file at the same time.
patc scans the text from begin to end for patterns, starting with the first
not yet used character. Whenever patc finds a pattern, it executes the
corresponding action. This can be outputting a string, give an message,
or switch to another set of patterns. When no pattern can be found,
will output the first letter unchanged, and start searching again with the
next letter, or if you want that, it will complain about it.
The patterns patc can recognize are given in a patfile. A patfile consists
of lines, that can be empty (white space or comment), contain a command, or
a pattern with its corresponding action.
Comment lines start with %, command lines with an @ and a pattern line
with a ". Every line can end with comment.
Commands:
@patterns # definition of patterns in set # follows
@rpatterns # definition of patterns in set # follows.
if a pattern cannot be found in the input, this
will generate an error message.
@end end of patfile
A pattern line consists of the pattern inbetween double quotes, an
action opcode, and optionally a string in between codes as an argument.
Actions:
p string output string
# string output string, use pattern set # from now on.
e string give error message string, forget this pattern.
f forget this pattern (silently)
s skip until end of line (including this patten)
S string skip till first char of string
B skip till closing brace, matching braces)
c copy until end of line (including this patten)
t copy a TeX command
T skip a TeX command
In strings and patterns the following escape codes can be used:
\t tab
\n newline
\" double quote
\\ backslash
\b backspace
\xxx character xxx octal
\dxxx character xxx decimal
\hxx character xx hexadecimal
Do _not_ use character \000 !
Warning
-------
Don't give patterns in alfabetic order. The algorithm used will show its
worse case performance then.
Wishes for future versions
--------------------------
* Include meta-characters, as to decrease the number of patterns.
Proposed syntax:
@META \C "b" "c" "d" "f" ... consonants
@META \V "a" "e" "i" "o" ... vowels
This is quite difficult, and requires a rethink of the underlying
data structures, so it will take some time. Any volunteer?
* Make it count. (easy too)
* More actions.
Author
------
Jeroen Hellingman. <jhelling@cs.ruu.nl>
't Zand 2, 4133 TB Vianen, The Netherlands
Copyright & disclaimer
----------------------
This program may be used, copied, and distributed by anyone who feels the
need, but it is copyrighted by me. This is offered free as it is, I do not
accept any responseability when it does not do what you want it to do.
|