summaryrefslogtreecommitdiffstats
path: root/ppapi/generators/idl_parser.py
diff options
context:
space:
mode:
authornoelallen@google.com <noelallen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-22 16:34:13 +0000
committernoelallen@google.com <noelallen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-22 16:34:13 +0000
commitcaff0c340f4abbe36fb5ad24f2c55811003bea8d (patch)
treeca34d1223453509e12183a9f50a1862d0ca127e0 /ppapi/generators/idl_parser.py
parent05d7cf8c9bbf1585224fe839184fbc5d9f9b70dd (diff)
downloadchromium_src-caff0c340f4abbe36fb5ad24f2c55811003bea8d.zip
chromium_src-caff0c340f4abbe36fb5ad24f2c55811003bea8d.tar.gz
chromium_src-caff0c340f4abbe36fb5ad24f2c55811003bea8d.tar.bz2
Adding linter for IDL
Removing current warnings from parser and create a new file which will traverse AST after it is built looking for possible issues. Also includes minor comment cleanup for visitor class on which the linter is based. TEST= python idl_parser.py BUG= http://code.google.com/p/chromium/issues/detail?id=76271 R= sehr@google.com Review URL: http://codereview.chromium.org/7468012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93655 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/generators/idl_parser.py')
-rw-r--r--ppapi/generators/idl_parser.py26
1 files changed, 3 insertions, 23 deletions
diff --git a/ppapi/generators/idl_parser.py b/ppapi/generators/idl_parser.py
index 77093f6..30e487b 100644
--- a/ppapi/generators/idl_parser.py
+++ b/ppapi/generators/idl_parser.py
@@ -35,6 +35,7 @@ from idl_log import ErrOut, InfoOut, WarnOut
from idl_lexer import IDLLexer
from idl_node import IDLAttribute, IDLFile, IDLNode
from idl_option import GetOption, Option, ParseOptions
+from idl_lint import Lint
from ply import lex
from ply import yacc
@@ -44,8 +45,6 @@ Option('parse_debug', 'Debug parse reduction steps.')
Option('token_debug', 'Debug token generation.')
Option('dump_tree', 'Dump the tree.')
Option('srcroot', 'Working directory.', default='../api')
-Option('wcomment', 'Disable warning for missing comment.')
-Option('wenum', 'Disable warning for missing enum value.')
#
# ERROR_REMAP
@@ -710,26 +709,6 @@ class IDLParser(IDLLexer):
return tok
#
-# VerifyProduction
-#
-# Once the node is built, we will check for certain types of issues
-#
- def VerifyProduction(self, node):
- comment = node.GetOneOf('Comment')
- if node.cls in ['Interface', 'Struct', 'Member'] and not comment:
- if not GetOption('wcomment') and not node.GetProperty('wcomment'):
- self.Warn(node, 'Missing comment for %s.' % node)
- elif node.cls in ['EnumItem'] and not node.GetProperty('VALUE'):
- if not GetOption('wenum'):
- self.Warn(node, 'Missing value for enumeration %s.' % node)
- elif node.cls in ['Param']:
- found = False;
- for form in ['in', 'inout', 'out']:
- if node.GetProperty(form): found = True
- if not found: self.Warn(node, 'Missing argument type: [in|out|inout]')
-
-
-#
# BuildProduction
#
# Production is the set of items sent to a grammar rule resulting in a new
@@ -747,7 +726,6 @@ class IDLParser(IDLLexer):
out = IDLNode(cls, filename, lineno, pos, childlist)
if self.build_debug:
InfoOut.Log("Building %s" % out)
- self.VerifyProduction(out)
return out
def BuildNamed(self, cls, p, index, childlist=None):
@@ -1010,6 +988,8 @@ def ParseFiles(filenames):
ast = IDLAst(filenodes)
if GetOption('dump_tree'): ast.Dump(0)
+
+ Lint(ast)
return ast