<?xml version="1.0"?>
<clause number="9.3" title="Lexical analysis">
  <paragraph>The input production defines the lexical structure of a C# source file. Each source file in a C# program must conform to this lexical grammar production. <grammar_production><name>input</name> :: <rhs><non_terminal where="9.3">input-section</non_terminal><opt/></rhs></grammar_production><grammar_production><name><non_terminal where="9.3">input-section</non_terminal></name> :: <rhs><non_terminal where="9.3">input-section-part</non_terminal></rhs><rhs><non_terminal where="9.3">input-section</non_terminal><non_terminal where="9.3">input-section-part</non_terminal></rhs></grammar_production><grammar_production><name><non_terminal where="9.3">input-section-part</non_terminal></name> :: <rhs><non_terminal where="9.3">input-elements</non_terminal><opt/><non_terminal where="9.3.1">new-line</non_terminal></rhs><rhs><non_terminal where="9.5">pp-directive</non_terminal></rhs></grammar_production><grammar_production><name><non_terminal where="9.3">input-element</non_terminal>s</name> :: <rhs><non_terminal where="9.3">input-element</non_terminal></rhs><rhs><non_terminal where="9.3">input-elements</non_terminal><non_terminal where="9.3">input-element</non_terminal></rhs></grammar_production><grammar_production><name><non_terminal where="9.3">input-element</non_terminal></name> :: <rhs><non_terminal where="9.3.3">whitespace</non_terminal></rhs><rhs><non_terminal where="9.3.2">comment</non_terminal></rhs><rhs><non_terminal where="9.4">token</non_terminal></rhs></grammar_production></paragraph>
  <paragraph>Five basic elements make up the lexical structure of a C# source file: Line terminators (<hyperlink>9.3.1</hyperlink>), white space (<hyperlink>9.3.3</hyperlink>), comments (<hyperlink>9.3.2</hyperlink>), tokens (<hyperlink>9.4</hyperlink>), and pre-processing directives (<hyperlink>9.5</hyperlink>). Of these basic elements, only tokens are significant in the syntactic grammar of a C# program (<hyperlink>9.2.2</hyperlink>). </paragraph>
  <paragraph>The lexical processing of a C# source file consists of reducing the file into a sequence of tokens which becomes the input to the syntactic analysis. Line terminators, white space, and comments can serve to separate tokens, and pre-processing directives can cause sections of the source file to be skipped, but otherwise these lexical elements have no impact on the syntactic structure of a C# program. </paragraph>
  <paragraph>When several lexical grammar productions match a sequence of characters in a source file, the lexical processing always forms the longest possible lexical element. <example>[Example: For example, the character sequence // is processed as the beginning of a single-line comment because that lexical element is longer than a single / token. end example]</example> </paragraph>
</clause>
