fixed a bug in emitting a string
This commit is contained in:
@ -2,13 +2,17 @@
|
||||
|
||||
AWK Interpreter
|
||||
|
||||
VARIABLE DECLARATION
|
||||
@section awk_ext EXTENSION
|
||||
Some language extensions are implemented and they can be enabled by setting the
|
||||
corresponding options.
|
||||
|
||||
QSE_AWK_EXPLICIT enables variable declaration. Variables declared are accessed
|
||||
@subsection awk_ext_vardecl VARIABLE DECLARATION
|
||||
|
||||
#QSE_AWK_EXPLICIT enables variable declaration. Variables declared are accessed
|
||||
directly bypassing the global named map that stores undeclared variables.
|
||||
The keyword global introduces a global variable and the keyword local introduces
|
||||
a local variable. Local variable declaraion in a block should be located before
|
||||
an expression or a statement appears.
|
||||
The keyword @b global introduces a global variable and the keyword @b local
|
||||
introduces local variable. Local variable declaraion in a block must be
|
||||
located before an expression or a statement appears.
|
||||
|
||||
@code
|
||||
global g1, g2; #declares two global variables g1 and g2
|
||||
@ -19,8 +23,8 @@ BEGIN {
|
||||
g1 = 300; a1 = 200;
|
||||
|
||||
{
|
||||
local a1; # this a1 hides the a1 at the outer scope
|
||||
local g1; # this g1 hides the global g1
|
||||
local a1; # a1 here hides the a1 at the outer scope
|
||||
local g1; # g1 here hides the global g1
|
||||
a1 = 10; g1 = 5;
|
||||
print a1, g1; # it prints 10 and 5
|
||||
}
|
||||
@ -30,26 +34,26 @@ BEGIN {
|
||||
|
||||
@endcode
|
||||
|
||||
However, turning on QSE_AWK_EXPLICIT does not disable named variables.
|
||||
To disable named variables, you must turn off QSE_AWK_IMPLICIT.
|
||||
However, turning on #QSE_AWK_EXPLICIT does not disable named variables.
|
||||
To disable named variables, you must turn off #QSE_AWK_IMPLICIT.
|
||||
|
||||
INCLUDE
|
||||
@subsection awk_ext_include INCLUDE
|
||||
|
||||
The \@include directive inserts the contents of the object specified in the
|
||||
following string, typically a file name, as if they appeared in the source
|
||||
stream being processed. The directive can only be used at the outmost scope
|
||||
where global variable declarations, BEGIN, END, and/or pattern-action blocks
|
||||
appear. To use \@include, you must turn on QSE_AWK_INCLUDE.
|
||||
where global variable declarations, @b BEGIN, @b END, and/or pattern-action
|
||||
blocks appear. To use \@include, you must turn on #QSE_AWK_INCLUDE.
|
||||
|
||||
@code
|
||||
@include "abc.awk"
|
||||
BEGIN { func_in_abc (); }
|
||||
@endcode
|
||||
|
||||
TWO-WAY PIPE
|
||||
@subsection awk_ext_rwpipe TWO-WAY PIPE
|
||||
|
||||
The two-way pipe indicated by '||' is supproted, in addition to the one-way
|
||||
pipe indicated by '|'. Turn on QSE_AWK_RWPIPE to enable the two-way pipe.
|
||||
The two-way pipe indicated by @b || is supproted, in addition to the one-way
|
||||
pipe indicated by @b |. Turn on #QSE_AWK_RWPIPE to enable the two-way pipe.
|
||||
|
||||
@code
|
||||
BEGIN {
|
||||
|
@ -94,14 +94,14 @@ Terminates the exection of commands quietly.
|
||||
- <b>a \\ \n text</b>
|
||||
Stores @b text into the append buffer which is printed after the pattern
|
||||
space for each input line. If #QSE_SED_STRICT is on, an address range is not
|
||||
allowed for a line selector. If #QSE_SED_NEWLINE is specified, the backslash
|
||||
and the text can be located on the same line without a line break.
|
||||
allowed for a line selector. If #QSE_SED_SAMELINE is on, the backslash and the
|
||||
text can be located on the same line without a line break.
|
||||
|
||||
- <b>i \\ \n text</b>
|
||||
Inserts @b text into an insert buffer which is printed before the pattern
|
||||
space for each input line. If #QSE_SED_STRICT is on, an address range is not
|
||||
allowed for a line selector. If #QSE_SED_NEWLINE is specified, the backslash
|
||||
and the text can be located on the same line without a line break.
|
||||
allowed for a line selector. If #QSE_SED_SAMELINE is on, the backslash and the
|
||||
text can be located on the same line without a line break.
|
||||
|
||||
- <b>c \\ \n text</b>
|
||||
If a single line is selected for the command (i.e. no line selector, a single
|
||||
@ -109,7 +109,7 @@ address line selector, or a start~step line selector is specified), it changes
|
||||
the pattern space to @b text and branches to the end of commands for the line.
|
||||
If an address range is specified, it deletes the pattern space and branches
|
||||
to the end of commands for all input lines but the last, and changes pattern
|
||||
space to @b text and branches to the end of commands. If #QSE_SED_NEWLINE is
|
||||
space to @b text and branches to the end of commands. If #QSE_SED_SAMELINE is
|
||||
on, the backlash and the text can be located on the same line without a line
|
||||
break.
|
||||
|
||||
@ -122,8 +122,8 @@ it branches to the end of script. Otherwise, the commands from the first are
|
||||
reapplied to the current pattern space.
|
||||
|
||||
- <b>=</b>
|
||||
Prints the current line number. If #QSE_SED_STRICT is speccified, an address
|
||||
range is not allowed in the line selector.
|
||||
Prints the current line number. If #QSE_SED_STRICT is on, an address range is
|
||||
not allowed as a line selector.
|
||||
|
||||
- <b>p</b>
|
||||
Prints the pattern space.
|
||||
@ -178,8 +178,8 @@ error.
|
||||
|
||||
- <b>R file</b>
|
||||
Reads a line of text from @b file and prints it after printing pattern space
|
||||
but before printing the append buffer. Failure to read @b file does not cause an
|
||||
error.
|
||||
but before printing the append buffer. Failure to read @b file does not cause
|
||||
an error.
|
||||
|
||||
- <b>w file</b>
|
||||
Writes the pattern space to @b file
|
||||
|
Reference in New Issue
Block a user