changeset 61:67cade0e35b0

impl isLiteral
author Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
date Tue, 14 Jul 2015 16:00:44 +0900
parents 8616a045a7f4
children a49b4a8b8c14
files c/regexParser/main.cc
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/c/regexParser/main.cc	Tue Jul 14 15:30:34 2015 +0900
+++ b/c/regexParser/main.cc	Tue Jul 14 16:00:44 2015 +0900
@@ -64,11 +64,18 @@
     return n;
 }
 
+bool isLiteral(char c) {
+    if (('a'<=c && c<='z')||('A'<=c && c<='Z')||('0'<=c && c<='9')) {
+        return true;
+    }
+    return false;
+}
+
 // <string> ::= <literal><literal>*
 NodePtr string() {
     char c = *ptr;
     NodePtr n = NULL;
-    if (('a'<=c && c<='z')||('A'<=c && c<='Z')||('0'<=c && c<='9')) {
+    if (isLiteral(c)) {
         n = createNode(0,literal(),string());
     } else {
         n = createNode(0,0,0);