<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!-- One method to get references from the online citation libraries.
     There has to be one entity for each item to be referenced. 
     An alternate method (rfc include) is described in the references. -->

<!ENTITY RFC5234 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5234.xml">
]>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<!-- used by XSLT processors -->
<!-- For a complete list and description of processing instructions (PIs), 
     please see http://xml.resource.org/authoring/README.html. -->
<!-- Below are generally applicable Processing Instructions (PIs) that most I-Ds might want to use.
     (Here they are set differently than their defaults in xml2rfc v1.32) -->
<?rfc strict="yes" ?>
<!-- give errors regarding ID-nits and DTD validation -->
<!-- control the table of contents (ToC) -->
<?rfc toc="yes"?>
<!-- generate a ToC -->
<?rfc tocdepth="4"?>
<!-- the number of levels of subsections in ToC. default: 3 -->
<!-- control references -->
<?rfc symrefs="yes"?>
<!-- use symbolic references tags, i.e, [RFC2119] instead of [1] -->
<?rfc sortrefs="yes" ?>
<!-- sort the reference entries alphabetically -->
<!-- control vertical white space 
     (using these PIs as follows is recommended by the RFC Editor) -->
<?rfc compact="yes" ?>
<!-- do not start each main section on a new page -->
<?rfc subcompact="no" ?>
<!-- keep one blank line between list items -->
<!-- end of list of popular I-D processing instructions -->
<rfc category="std" docName="draft-kyzivat-case-sensitive-abnf-02" ipr="trust200902" updates="5234">
  <!-- category values: std, bcp, info, exp, and historic
     ipr values: full3667, noModification3667, noDerivatives3667
     you can add the attributes updates="NNNN" and obsoletes="NNNN" 
     they will automatically be output with "(if approved)" -->

  <!-- ***** FRONT MATTER ***** -->

  <front>
    <!-- The abbreviated title is used in the page header - it is only necessary if the 
         full title is longer than 39 characters -->

    <title abbrev="Case-Sensitive String Support in ABNF">Case-Sensitive String Support in ABNF</title>

    <!-- add 'role="editor"' below for the editors if appropriate -->

    <author fullname="Paul Kyzivat" initials="P."
            surname="Kyzivat">

      <address>
        <postal>
          <street></street>

          <!-- Reorder these if your country does things differently -->

          <city></city>

          <region>Massachusetts</region>

          <code></code>

          <country>US</country>
        </postal>

        <phone></phone>

        <email>pkyzivat@alum.mit.edu</email>

        <!-- uri and facsimile elements may also be added -->
      </address>
    </author>

    <date year="2014" />

    <!-- If the month and year are both specified and are the current ones, xml2rfc will fill 
         in the current day for you. If only the current year is specified, xml2rfc will fill 
	 in the current day and month for you. If the year is not the current one, it is 
	 necessary to specify at least a month (xml2rfc assumes day="1" if not specified for the 
	 purpose of calculating the expiry date).  With drafts it is normally sufficient to 
	 specify just the year. -->

    <!-- Meta-data Declarations -->

    <area>General</area>

    <workgroup>Internet Engineering Task Force</workgroup>

    <!-- WG name at the upperleft corner of the doc,
         IETF is fine for individual submissions.  
	 If this element is not present, the default is "Network Working Group",
         which is used by the RFC Editor as a nod to the history of the IETF. -->

    <keyword>BNF ABNF Syntax</keyword>

    <!-- Keywords will be incorporated into HTML output
         files in a meta tag but they have no effect on text or nroff
         output. If you submit your draft to the RFC Editor, the
         keywords will be used for the search engine. -->

    <abstract>
      <t>
This document extends the base definition of ABNF (Augmented Backus-Naur Form) to include 
a way to specify ASCII string literals that are matched in a case-sensitive manner.
      </t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
      <t>
The base definition of ABNF (Augmented Backus-Naur Form) supports ASCII string literals.
Matching of these literals is done in a case-insensitive manner.
While this is often the desired behavior, in some situations case-sensitive matching of string literals is needed.
Literals for case-sensitive matching must be specified using the numeric representation of those characters.
That is inconvenient and error prone both to write and to read.
      </t>
      <t>
This document extends ABNF to have two different types of ASCII string literals.
One type is matched using case-sensitive matching, 
while the other is matched using case-insensitive matching.
These types are denoted using type prefixes, similar to the type prefixes used with numeric values.
If no prefix is used, then case-insensitive matching is used, consistent with previous behavior.
      </t>
      <t>
This document is structured as a set of changes to the full ABNF specification <xref target="RFC5234"/>. 
      </t>
    </section>

    <section title="Updates to RFC5234">
      <t>
This document makes changes to two parts of RFC5234. 
The two changes are: 
      </t>
      <t><list style="symbols">
        <t>
Replace the last half of section 2.3 of RFC5234 
(beginning with "ABNF permits the specification of literal text strings") 
with the contents of <xref target="sec.terminal_values"/> below.
        </t>
        <t>
<![CDATA[ Replace the <char-val> rule in section 4 of RFC5234 ]]> 
with the contents of <xref target="sec.abnf_abnf"/> below.
        </t>
      </list></t>

      <section anchor="sec.terminal_values" title="Terminal values - literal text strings">
        <t>
ABNF permits the specification of literal text strings directly,
enclosed in quotation marks.  Hence:
        </t>
        <figure><artwork type="abnf"><![CDATA[
      command     =  "command string"
        ]]></artwork></figure>
        <t>
Literal text strings are interpreted as a concatenated set of
printable characters. The character set for these strings is
US-ASCII.
        </t><t>
Literal text strings in ABNF may be either case sensitive or case
insensitive. The form of matching used with a literal text string is
denoted by a prefix to the quoted string. The following prefixes are
allowed:
        </t>
        <figure><artwork type="abnf"><![CDATA[
      %s          =  case-sensitive
      %i          =  case-insensitive
        ]]></artwork></figure>
        <t>
To be consistent with prior implementations of ABNF, having no
prefix means that the string is case-insensitive, and is equivalent
to having the "%i" prefix.

        </t><t>
Hence:
        </t>
        <figure><artwork type="abnf"><![CDATA[
      rulename = %i"aBc"
        ]]></artwork></figure>
        <t>
and:
        </t>
        <figure><artwork type="abnf"><![CDATA[
      rulename = "abc"
        ]]></artwork></figure>
        <t>
will both match "abc", "Abc", "aBc", "abC", "ABc", "aBC", "AbC", and
"ABC".
        </t><t>
In contrast:
        </t>
        <figure><artwork type="abnf"><![CDATA[
      rulename = %s"aBc"
        ]]></artwork></figure>
        <t>
will match only "aBc", and will not match "abc", "Abc", "abC",
"ABc", "aBC", "AbC", or "ABC".
        </t><t>
The way that has been used in the past to define a rule that
is case sensitive is to specify the individual characters
numerically.
        </t><t>
For example:
        </t>
        <figure><artwork type="abnf"><![CDATA[
      rulename    =  %d97 %d98 %d99
        ]]></artwork></figure>
        <t>
or
        </t>
        <figure><artwork type="abnf"><![CDATA[
      rulename    =  %x61.62.63
        ]]></artwork></figure>
        <t>
will match only the string that comprises only the lowercase
characters, abc.
The new way (using a literal text string with a prefix) has a clear readability advantage over the old way.
        </t>
      </section>
      <section anchor="sec.abnf_abnf" title="ABNF Definition of ABNF - char-val">
        <figure><artwork type="abnf"><![CDATA[
      char-val       =  case-insensitive-string /
                        case-sensitive-string

      case-insensitive-string =
                        [ "%i" ] quoted-string

      case-sensitive-string =
                        "%s" quoted-string

      quoted-string  =  DQUOTE *(%x20-21 / %x23-7E) DQUOTE
                             ; quoted string of SP and VCHAR
                             ;  without DQUOTE
        ]]></artwork></figure>
      </section>
    </section>

    <section anchor="IANA" title="IANA Considerations">
      <t>This memo includes no request to IANA.</t>
    </section>

    <section anchor="Security" title="Security Considerations">
      <t>Security is truly believed to be irrelevant to this document.</t>
    </section>
  </middle>

  <!--  *****BACK MATTER ***** -->

  <back>
   <references title="Normative References">
      &RFC5234;
    </references>
  </back>
</rfc>
