Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
basic quoting
  • Loading branch information
lichtkind committed Jul 25, 2014
1 parent a00d083 commit 6598f3d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
11 changes: 6 additions & 5 deletions docs/appendix-b-grouped.txt
Expand Up @@ -656,9 +656,9 @@ Use it as in `$filename.IO ~~ :X` or `$filename.IO.X`.
Quoting Ops
-----------

The basic quoting operator (Q) does nothing, just taking literally
what you quoted as a string. But with several adverbs, it behaves like
the well known following ops:
The basic [basic quoting](tablet-2-basic-syntax.html#quoting)
operator (Q) does nothing, just taking literally what you quoted as a string.
But with several adverbs, it behaves like the well known following ops:

Op Nonealphanumeric Version Translated Into Quoting Adverbs Method Version Meaning
--------------------------------------- --------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------- ----------------------------------------------------------
Expand Down Expand Up @@ -686,8 +686,9 @@ Text Processing
Quoting Adverbs
---------------

There are a lot more adverbs to fine tune your quoting. The Adverbs
can used with any quoting operator like:
There are a lot more adverbs to
[fine tune your quoting](tablet-2-basic-syntax.html#interpolation).
The Adverbs can used with any quoting operator like:
[Q](appendix-a-index.html#Q-op) :s/.../ or
[qq](appendix-a-index.html#qq-op) :p /.../.

Expand Down
28 changes: 17 additions & 11 deletions docs/tablet-2-basic-syntax.txt
Expand Up @@ -32,8 +32,12 @@ Exporter, English, an advanced pretty printer and much more is already built in.
So you get a lot extra for a little *v6;**.


Code Layout
===========


Statements and Semicolon
========================
------------------------

Unless you use [*blocks*](appendix-g-glossary.html#block), a Perl
program executes one statement after another in linear progression
Expand All @@ -47,7 +51,7 @@ Line endings have inside the main language no syntactical effect.


Spaces and Indentation
======================
----------------------

Perl doesn't care about indentation, but it does care about whitespace
as a disambiguator. For example, `$foo$bar` is a syntax error since that
Expand Down Expand Up @@ -136,33 +140,35 @@ Quoting
=======

Quoting, like [regular expression](tablet-9-regexes.html), is a sublanguage
inside the main language with its own syntactical rules. It is parsed
by a special grammar which can be found in the [special
variable](appendix-b-grouped.html#special-variables) `$~Quote`. The
operator with the same name (the generic quoting operator `Q`) does
almost nothing, just provides a mechanism to mark the beginning and
end of text sequence.
(in short slang) inside the main language with its own syntactical rules.
It is parsed (recognized) by a special [*grammar*](appendix-g-glossary.html#grammar),
which can be found in the [special variable](appendix-b-grouped.html#special-variables) `$~Quote`.




Delimiter
---------

The generic quoting operator `Q` does almost nothing,
just provides a mechanism to mark the beginning and end of the quote.
Other quoting ops just reuse this and add feature regarding the content.

The examples in this chapter use slashes as the delimier in almost
all cases, however any non-alphanumeric character or pair of matching
(bracing) characters can be used as well.

Q /.../ or Q |...| or Q *...* or Q "..." or Q[...] ...

An extended delimiter mechanism is delivered by [heredocs](#heredocs).
An even extended delimiter mechanism is delivered by [heredocs](#heredocs).



Interpolation
-------------

Within these delimiters, every character will be taken
literally. Any additional meaning has to be added by [quoting
literally. Any additional meaning has to be activated by [quoting
adverbs](appendix-b-grouped.html#quoting-adverbs) that have to
follow the Q. Most of them have a short and a long name and some of
the most useful have an additional syntax that replaces them
Expand Down Expand Up @@ -291,7 +297,7 @@ Heredocs
--------

Heredocs are now normal quoted strings, only with a special delimiter, defined
by the adverbs **to** and heredoc. Heredocs can be nested.
by the adverbs **to** and **heredoc**. Heredocs can be nested.

Q :to 'EOT';
...
Expand Down

0 comments on commit 6598f3d

Please sign in to comment.