[flang] Handle empty files gracefully.

Create interval.h.  Use std::size_t instead of bare size_t.  Redefine parser::Name to not be just a bare string.

Break out and rename CharBlock from token-sequence.h for use in the parse tree.

Incremental replacement of name strings with pointers to cooked characters.

Fix case sensitivity problem.

Use new CharBlock encoding to replace strings for real literal constants.

Normalized cooked character stream to lower case.

Simplify parsing now that cooked stream is lower case.  Replace Keyword in parse tree.

Add static_asserts to || and recovery parsers to enforce same result types.

Remove needless TODO comment inserted earlier.

Fix case conversion on prefixed character literals (f90_correct/dc04.f90).

Use CharBlock in user-state.h.

Complete transition from nextChar to nextCh (i.e., always use pointers).

Document extensions.  Begin work on compiler directive lines.

More documentation work.

Reformat prescan.cc.

More work on compiler directive scanning.

Original-commit: flang-compiler/f18@38d0404e16ee7c797c69bc38fa64bcb55413884a
Reviewed-on: https://github.com/flang-compiler/f18/pull/29
Tree-same-pre-rewrite: false
diff --git a/flang/lib/parser/preprocessor.h b/flang/lib/parser/preprocessor.h
index 7b6d1a5..2a67944 100644
--- a/flang/lib/parser/preprocessor.h
+++ b/flang/lib/parser/preprocessor.h
@@ -7,8 +7,10 @@
 // performed, so that special compiler command options &/or source file name
 // extensions for preprocessing will not be necessary.
 
+#include "char-block.h"
 #include "provenance.h"
 #include "token-sequence.h"
+#include <cstddef>
 #include <list>
 #include <stack>
 #include <string>
@@ -23,13 +25,13 @@
 // Defines a macro
 class Definition {
 public:
-  Definition(const TokenSequence &, size_t firstToken, size_t tokens);
+  Definition(const TokenSequence &, std::size_t firstToken, std::size_t tokens);
   Definition(const std::vector<std::string> &argNames, const TokenSequence &,
-      size_t firstToken, size_t tokens, bool isVariadic = false);
+      std::size_t firstToken, std::size_t tokens, bool isVariadic = false);
   Definition(const std::string &predefined, AllSources *);
 
   bool isFunctionLike() const { return isFunctionLike_; }
-  size_t argumentCount() const { return argumentCount_; }
+  std::size_t argumentCount() const { return argumentCount_; }
   bool isVariadic() const { return isVariadic_; }
   bool isDisabled() const { return isDisabled_; }
   bool isPredefined() const { return isPredefined_; }
@@ -41,10 +43,10 @@
 
 private:
   static TokenSequence Tokenize(const std::vector<std::string> &argNames,
-      const TokenSequence &token, size_t firstToken, size_t tokens);
+      const TokenSequence &token, std::size_t firstToken, std::size_t tokens);
 
   bool isFunctionLike_{false};
-  size_t argumentCount_{0};
+  std::size_t argumentCount_{0};
   bool isVariadic_{false};
   bool isDisabled_{false};
   bool isPredefined_{false};
@@ -73,17 +75,17 @@
   enum class IsElseActive { No, Yes };
   enum class CanDeadElseAppear { No, Yes };
 
-  ContiguousChars SaveTokenAsName(const ContiguousChars &);
-  bool IsNameDefined(const ContiguousChars &);
+  CharBlock SaveTokenAsName(const CharBlock &);
+  bool IsNameDefined(const CharBlock &);
   TokenSequence ReplaceMacros(const TokenSequence &, const Prescanner &);
   void SkipDisabledConditionalCode(
       const std::string &, IsElseActive, Prescanner *, Provenance);
-  bool IsIfPredicateTrue(
-      const TokenSequence &expr, size_t first, size_t exprTokens, Prescanner *);
+  bool IsIfPredicateTrue(const TokenSequence &expr, std::size_t first,
+      std::size_t exprTokens, Prescanner *);
 
   AllSources *allSources_;
   std::list<std::string> names_;
-  std::unordered_map<ContiguousChars, Definition> definitions_;
+  std::unordered_map<CharBlock, Definition> definitions_;
   std::stack<CanDeadElseAppear> ifStack_;
 };
 }  // namespace parser