summaryrefslogtreecommitdiff
path: root/flang/lib/parser/characters.cc
diff options
context:
space:
mode:
authorpeter klausler <pklausler@nvidia.com>2018-03-20 10:59:07 -0700
committerpeter klausler <pklausler@nvidia.com>2018-03-23 13:32:55 -0700
commit424ec7b35b2fb40603b791b447d646dc9bf7f237 (patch)
tree31b53963b10ea0624a79863651ec7ef754e814c4 /flang/lib/parser/characters.cc
parenta91ad74d8e04b7005b82933d68ff36e2e9f12b8e (diff)
downloadllvm-424ec7b35b2fb40603b791b447d646dc9bf7f237.tar.gz
[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
Diffstat (limited to 'flang/lib/parser/characters.cc')
-rw-r--r--flang/lib/parser/characters.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/flang/lib/parser/characters.cc b/flang/lib/parser/characters.cc
index 8ead0b7955a3..7953fb98d447 100644
--- a/flang/lib/parser/characters.cc
+++ b/flang/lib/parser/characters.cc
@@ -1,4 +1,6 @@
#include "characters.h"
+#include <cstddef>
+#include <optional>
namespace Fortran {
namespace parser {
@@ -52,9 +54,9 @@ std::optional<int> EUC_JPCharacterBytes(const char *p) {
return {};
}
-std::optional<size_t> CountCharacters(
- const char *p, size_t bytes, std::optional<int> (*cbf)(const char *)) {
- size_t chars{0};
+std::optional<std::size_t> CountCharacters(
+ const char *p, std::size_t bytes, std::optional<int> (*cbf)(const char *)) {
+ std::size_t chars{0};
const char *limit{p + bytes};
while (p < limit) {
++chars;