update syntax plans
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
class Query
|
||||
def initialize(type, value, capturing)
|
||||
@type = type
|
||||
@value = value
|
||||
@query_l = nil
|
||||
@query_r = nil
|
||||
@capturing = capturing
|
||||
end
|
||||
|
||||
def &(other)
|
||||
@query_l = self
|
||||
@query_r = other
|
||||
self.type = :and
|
||||
self
|
||||
end
|
||||
|
||||
def |(other)
|
||||
@query_l = self
|
||||
@query_r = other
|
||||
self.type = :or
|
||||
self
|
||||
end
|
||||
end
|
||||
|
||||
def tag(name, capturing = false)
|
||||
return Query.new(:tag, name, capturing)
|
||||
end
|
||||
|
||||
def component(name, capturing = false)
|
||||
return Query.new(:component, name, capturing)
|
||||
end
|
||||
|
||||
def name(name, capturing = false)
|
||||
return Query.new(:name, name, capturing)
|
||||
end
|
||||
|
||||
def anti(query)
|
||||
query.type = :"not_#{query.type}"
|
||||
query
|
||||
end
|
||||
Reference in New Issue
Block a user