#!/usr/bin/env python
+import re
import weakref
from util import algorithms
}
+_VARIABLE_VALIDATION_RE = re.compile("^[a-zA-Z0-9]+$")
+
+
+def validate_variable_name(variableName):
+ match = _VARIABLE_VALIDATION_RE.match(variableName)
+ if match is None:
+ raise RuntimeError("Invalid characters")
+
+
def parse_number(userInput):
try:
base = __BASE_MAPPINGS.get(userInput[0:2], 10)
def __init__(self, history, entry, errorReporting, constants, operations):
self.history = history
+ self.history._parse_value = self._parse_value
self.__entry = weakref.ref(entry)
self.__errorReporter = errorReporting
except KeyError:
pass
+ validate_variable_name(userInput)
return operation.Variable(userInput)
def _apply_operation(self, Node):