refine the documentation, add extra warning messages
[lunaix-os.git] / lunaix-os / scripts / build-tools / lcfg2 / rules.py
index 35f770f8e494d085f8a8bc094f1d6e5f18f50d03..f77460d14a848c6a9aebb312c5f5c037bb00fb9c 100644 (file)
@@ -7,39 +7,9 @@ class SyntaxRule(RuleCollection):
     NodeAssigment = Schema(ast.Subscript, 
                             value=Schema(ast.Name, id='__lzLut__'), 
                             ctx=ast.Store)
-    TrivialValue = Schema(Schema.Union(
-        ast.Constant, 
-        ast.Name, 
-        Schema(ast.Subscript, 
-               value=Schema(ast.Name, id='__lzLut__'), 
-               slice=ast.Constant)
-    ))
 
-    BoolOperators = Schema(Schema.Union(ast.Or, ast.And))
-    
-    TrivialTest    = Schema(ast.Compare, 
-                          left=TrivialValue, 
-                          ops=[Schema.Union(ast.Eq, ast.In)],
-                          comparators=[Schema.Union(
-                              ast.Constant, 
-                              Schema(ast.List, elts=Schema.List(ast.Constant))
-                          )])
-    
-    InlineIf       = Schema(ast.IfExp, 
-                            test=Schema.Union(TrivialTest, TrivialValue), 
-                            body=TrivialValue, 
-                            orelse=TrivialValue)
-    
-    TrivialLogic   = Schema(ast.BoolOp, 
-                            op=BoolOperators, 
-                            values=Schema.List(
-                                Schema.Union(TrivialTest, ast.Name)
-                            ))
-    
     TrivialReturn  = Schema(Schema.Union(
-        TrivialValue,
-        InlineIf,
-        TrivialLogic,
+        ast.Constant,
         ast.JoinedStr
     ))
 
@@ -91,6 +61,6 @@ class SyntaxRule(RuleCollection):
     @rule(ast.Return, None, "non-trivial-value")
     def __nontrivial_return(self, reducer, node):
         """
-        Option default should be kept as constant or simple membership check
+        Use of non-trivial value as default value
         """
         return SyntaxRule.TrivialReturn == node.value 
\ No newline at end of file