Extract keywords from whole PreProc syntax group
Reorder syntax groups to follow documentation order.
This commit is contained in:
parent
b50984be76
commit
d3916a8752
@ -55,11 +55,11 @@ SYNTAX_NEXTGROUP_ARGUMENTS = set([
|
|||||||
|
|
||||||
# These are the parent groups from which we want to extract keywords.
|
# These are the parent groups from which we want to extract keywords.
|
||||||
ROOT_GROUPS = set([
|
ROOT_GROUPS = set([
|
||||||
'Statement',
|
|
||||||
'Boolean',
|
'Boolean',
|
||||||
'Include',
|
'Identifier',
|
||||||
'Type',
|
'Statement',
|
||||||
'Identifier'
|
'PreProc',
|
||||||
|
'Type'
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@ -130,19 +130,22 @@ def _CreateInitialGroupMap():
|
|||||||
group_name_to_group[ name ] = new_group
|
group_name_to_group[ name ] = new_group
|
||||||
parent.children.append( new_group )
|
parent.children.append( new_group )
|
||||||
|
|
||||||
|
identifier_group = SyntaxGroup( 'Identifier' )
|
||||||
statement_group = SyntaxGroup( 'Statement' )
|
statement_group = SyntaxGroup( 'Statement' )
|
||||||
type_group = SyntaxGroup( 'Type' )
|
type_group = SyntaxGroup( 'Type' )
|
||||||
identifier_group = SyntaxGroup( 'Identifier' )
|
preproc_group = SyntaxGroup( 'PreProc' )
|
||||||
|
|
||||||
# See ":h group-name" for details on how the initial group hierarchy is built.
|
# See ":h group-name" for details on how the initial group hierarchy is built.
|
||||||
group_name_to_group = {
|
group_name_to_group = {
|
||||||
'Statement': statement_group,
|
|
||||||
'Type': type_group,
|
|
||||||
'Boolean': SyntaxGroup( 'Boolean' ),
|
'Boolean': SyntaxGroup( 'Boolean' ),
|
||||||
'Include': SyntaxGroup( 'Include' ),
|
|
||||||
'Identifier': identifier_group,
|
'Identifier': identifier_group,
|
||||||
|
'Statement': statement_group,
|
||||||
|
'PreProc': preproc_group,
|
||||||
|
'Type': type_group
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AddToGroupMap( 'Function', identifier_group )
|
||||||
|
|
||||||
AddToGroupMap( 'Conditional', statement_group )
|
AddToGroupMap( 'Conditional', statement_group )
|
||||||
AddToGroupMap( 'Repeat' , statement_group )
|
AddToGroupMap( 'Repeat' , statement_group )
|
||||||
AddToGroupMap( 'Label' , statement_group )
|
AddToGroupMap( 'Label' , statement_group )
|
||||||
@ -154,7 +157,10 @@ def _CreateInitialGroupMap():
|
|||||||
AddToGroupMap( 'Structure' , type_group )
|
AddToGroupMap( 'Structure' , type_group )
|
||||||
AddToGroupMap( 'Typedef' , type_group )
|
AddToGroupMap( 'Typedef' , type_group )
|
||||||
|
|
||||||
AddToGroupMap( 'Function', identifier_group )
|
AddToGroupMap( 'Include' , preproc_group )
|
||||||
|
AddToGroupMap( 'Define' , preproc_group )
|
||||||
|
AddToGroupMap( 'Macro' , preproc_group )
|
||||||
|
AddToGroupMap( 'PreCondit', preproc_group )
|
||||||
|
|
||||||
return group_name_to_group
|
return group_name_to_group
|
||||||
|
|
||||||
|
@ -140,6 +140,12 @@ def KeywordsFromSyntaxListOutput_PhpSyntax_ContainsFunctions_test():
|
|||||||
has_items( 'array_change_key_case' ) )
|
has_items( 'array_change_key_case' ) )
|
||||||
|
|
||||||
|
|
||||||
|
def KeywordsFromSyntaxListOutput_PhpSyntax_ContainsPreProc_test():
|
||||||
|
assert_that( syntax_parse._KeywordsFromSyntaxListOutput(
|
||||||
|
ContentsOfTestFile( 'php_syntax' ) ),
|
||||||
|
has_items( 'skip', 'function' ) )
|
||||||
|
|
||||||
|
|
||||||
def KeywordsFromSyntaxListOutput_Basic_test():
|
def KeywordsFromSyntaxListOutput_Basic_test():
|
||||||
assert_that( syntax_parse._KeywordsFromSyntaxListOutput( """
|
assert_that( syntax_parse._KeywordsFromSyntaxListOutput( """
|
||||||
foogroup xxx foo bar
|
foogroup xxx foo bar
|
||||||
|
Loading…
Reference in New Issue
Block a user