<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
]>

<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>

<?rfc toc="yes"?>
<?rfc tocdepth="4"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes" ?>
<?rfc compact="yes" ?>
<?rfc subcompact="no" ?>
<?rfc rfcedstyle="yes" ?>

<rfc number="7405" 
     category="std" 
     submissionType="IETF" 
     consensus="yes" 
     ipr="trust200902" 
     updates="5234">

  <front>
    <title abbrev="Case-Sensitive String Support in ABNF">Case-Sensitive
    String Support in ABNF</title>

    <author fullname="Paul Kyzivat" initials="P."
            surname="Kyzivat">
      <address>
        <postal>
          <street></street>
          <city></city>
          <region>Massachusetts</region>
          <code></code>
          <country>United States</country>
        </postal>
        <phone></phone>
        <email>pkyzivat@alum.mit.edu</email>
      </address>
    </author>

    <date month="November" year="2014" />

    <area>General</area>
    <workgroup>Internet Engineering Task Force</workgroup>

    <keyword>BNF ABNF Syntax</keyword>


    <abstract>
      <t>This document extends the base definition of ABNF (Augmented
      Backus-Naur Form) to include a way to specify US-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 US-ASCII string literals.
      The 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, which is inconvenient and error prone both to write and read.
      </t>
      
      <t>This document extends ABNF to have two different types of US-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 (as is
      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 RFC 5234">
      
      <t>This document makes changes to two parts of <xref target="RFC5234"/>. 
      The two changes are as follows: </t>
      <t><list style="symbols">
        <t>Replace the last half of Section 2.3 of <xref target="RFC5234"/> (beginning with
	"ABNF permits the specification of literal text strings") with the
	contents of <xref target="sec.terminal_values"/>.</t>
        <t>
	  Replace the &lt;char-val&gt; rule in Section 4 of <xref target="RFC5234"/>
	  with the contents of <xref target="sec.abnf_abnf"/>.</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. </t>

<t>NOTE:</t>
<t>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>
In the past, the numerical specification of individual characters was used to define a case-sensitive rule.
        </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.
	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="Security" title="Security Considerations">
      <t>Security is truly believed to be irrelevant to this document.</t>
    </section>

  </middle>

  <back>
   <references title="Normative References">

<reference anchor='RFC5234' target="http:/www.rfc-editor.org/info/rfc5234">
<front>
<title>Augmented BNF for Syntax Specifications: ABNF</title>
<author initials='D.' surname='Crocker' fullname='D. Crocker'>
<organization /></author>
<author initials='P.' surname='Overell' fullname='P. Overell'>
<organization /></author>
<date year='2008' month='January' />
</front>
<seriesInfo name='STD' value='68' />
<seriesInfo name='RFC' value='5234' />
<format type='TXT' octets='26359' target='http://www.rfc-editor.org/rfc/rfc5234.txt' />
</reference>

    </references>
  </back>
</rfc>
