From d9474c10c7af322caa737ee384b21914909d92de Mon Sep 17 00:00:00 2001 From: Serguei Makarov Date: Thu, 26 Jul 2012 14:00:30 -0400 Subject: [PATCH] PR14360: document string literal concatenation in language reference. --- doc/langref.tex | 28 ++++++++++++++++++++++++---- stap.1 | 7 ++++--- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/doc/langref.tex b/doc/langref.tex index adcdf1eee..fd1f6464c 100644 --- a/doc/langref.tex +++ b/doc/langref.tex @@ -1629,10 +1629,30 @@ in C. Integers are 64-bit signed quantities, although the parser also accepts \subsubsection{Strings\label{sub:Strings}} \index{strings} -Strings are enclosed in quotation marks ({}``string''), and pass through -standard C escape codes with backslashes. Strings are limited in length to -MAXSTRINGLEN. For more information about this and other limits, see -Section~\ref{sub:SystemTap-safety}. + +Strings are enclosed in quotation marks ({}``string''), and pass +through standard C escape codes with backslashes. A string literal may +be split into several pieces, which are glued together, as follows. + +\begin{vindent} +\begin{verbatim} +str1 = "foo" "bar" + /* --> becomes "foobar" */ + +str2 = "a good way to do a multi-line\n" + "string literal" + /* --> becomes "a good way to do a multi-line\nstring literal" */ + +str3 = "also a good way to " @1 " splice command line args" + /* --> becomes "also a good way to foo splice command line args", + assuming @1 is given as foo on the command line */ +\end{verbatim} +\end{vindent} + +Observe that script arguments can also be glued into a string literal. + +Strings are limited in length to MAXSTRINGLEN. For more information +about this and other limits, see Section~\ref{sub:SystemTap-safety}. \subsubsection{Associative arrays} diff --git a/stap.1 b/stap.1 index 93f55af05..aa8059ec8 100644 --- a/stap.1 +++ b/stap.1 @@ -627,11 +627,12 @@ Whitespace is ignored. Three forms of comments are supported: .BR /* " ... C style ... " */ .RE Literals are either strings enclosed in double-quotes (passing through -the usual C escape codes with backslashes), or integers (in decimal, +the usual C escape codes with backslashes, and with adjacent string +literals glued together, also as in C), or integers (in decimal, hexadecimal, or octal, using the same notation as in C). All strings are limited in length to some reasonable value (a few hundred bytes). -Integers are 64-bit signed quantities, although the parser also accepts -(and wraps around) values above positive 2**63. +Integers are 64-bit signed quantities, although the parser also +accepts (and wraps around) values above positive 2**63. .PP In addition, script arguments given at the end of the command line may be inserted. Use -- 2.43.5