Jelajahi Sumber

Fixed merge conflict.

Sander Mathijs van Veen 14 tahun lalu
induk
melakukan
a419a7b365
2 mengubah file dengan 4 tambahan dan 6 penghapusan
  1. 2 5
      src/c/bison_callback.c
  2. 2 1
      src/pyrex/bison_.pyx

+ 2 - 5
src/c/bison_callback.c

@@ -153,15 +153,12 @@ void py_input(PyObject *parser, char *buf, int *result, int max_size)
         Py_DECREF(handle);
         Py_DECREF(arglist);
 
-        if (unlikely(!res)) { return; }
+        if (unlikely(!res)) return;
     }
 
     // Read the input string and catch keyboard interrupt exceptions.
     handle = PyObject_GetAttr(parser, py_attr_read_name);
-    if (unlikely(!handle)) {
-        // TODO: set exception message for missing attribute error
-        return;
-    }
+    if (unlikely(!handle)) return;
 
     arglist = Py_BuildValue("(i)", max_size);
     if (unlikely(!arglist)) { Py_DECREF(handle); return; }

+ 2 - 1
src/pyrex/bison_.pyx

@@ -361,7 +361,8 @@ cdef class ParserEngine:
                             if option[i] == '%prec':
                                 i = i - 1
                                 break # hack for rules using '%prec'
-                            args.append('"%s", $%d' % (option[i], i+1))
+                            o = option[i].replace('"', '\\"')
+                            args.append('"%s", $%d' % (o, i+1))
 
                     # now, we have the correct terms count
                     action = action % (i + 1)