Skip to content

Commit

Permalink
pyr sort executor verbs, raise not implemented on rare tags
Browse files Browse the repository at this point in the history
add Qualifier class to handle protc:qualifier since we will likely
actually need that in the future
  • Loading branch information
tgbugs committed Aug 13, 2020
1 parent 5b8414f commit f7f5eda
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
3 changes: 1 addition & 2 deletions pysercomb/pyr/types.py
Expand Up @@ -76,8 +76,7 @@ def asJson(self):
out['value'] = value
elif (isinstance(value, str) or
isinstance(value, int) or
isinstance(value, float)
):
isinstance(value, float)):
#elif not (isinstance(value, dict) or
#isinstance(value, list) or
#value.__class__.__name__ == 'Term' # FIXME DUMB
Expand Down
34 changes: 32 additions & 2 deletions pysercomb/pyr/units.py
Expand Up @@ -284,6 +284,9 @@ def prov(self):
def asPython(self):
return self

def asJson(self):
return str(self)


class SExpr(tuple):
""" This class can act as a pretty formatter for s-exprs or it
Expand Down Expand Up @@ -1512,6 +1515,8 @@ class Protc(ImplFactoryHelper, Interpreter):
_SymbolicInput = None
_SymbolicOutput = None

_Qualifier = None

_CircularLink = None

plus = ParamParser.plus # FIXME common forms class?
Expand Down Expand Up @@ -1573,10 +1578,23 @@ def implied_aspect(self, aspect, *body, prov=None):
def measure(self, variable_name, *body, prov=None):
return self._Measure(variable_name, *body, prov=prov)

def result(self, args):
def result(self, value, *body, prov=None): # XXX
breakpoint()
return prov

def repeat(self, value, *body, prov=None): # XXX
raise NotImplementedError
#breakpoint()
# FIXME TODO WAT
return

def process(self, value, *body, prov=None): # XXX
raise NotImplementedError
breakpoint()

def qualifier(self, value, *body, prov=None): # XXX
return self._Qualifier(value, *body, prov=prov)

def executor_verb(self, verb, *body, prov=None):
return self._ExecutorVerb(verb, *body, prov=prov)

Expand Down Expand Up @@ -1958,7 +1976,7 @@ def __hash__(self):
return hash(self.name)


class ExecutorVerb(intf.AJ):
class ExecutorVerb(IdEqSortHelper, intf.AJ):

_type = 'protcur:executor-verb'

Expand Down Expand Up @@ -1998,6 +2016,17 @@ def _value(self):
return self.value


class Qualifier(intf.AJ):

_type = 'protcur:qualifier'

__init__ = SymbolicInput.__init__

@property
def _value(self):
return self.value


class Term(intf.AJ):

_OntTerm = None
Expand Down Expand Up @@ -2136,6 +2165,7 @@ def __init__(self, cycle):
ExecutorVerb,
SymbolicInput,
SymbolicOutput,
Qualifier,
Term,
FuzzyQuantity,
CircularLink,
Expand Down

0 comments on commit f7f5eda

Please sign in to comment.