class _IncludeState(object):
Tracks line numbers for includes, and the order in which includes appear.
include_list contains list of lists of (header, line number) pairs. It's a lists of lists rather than just one flat list to make it easier to update across preprocessor boundaries.
Call CheckNextIncludeOrder() once for each header in the file, passing in the type constants defined above. Calls in an illegal order will raise an _IncludeError with an appropriate error message.
Method | __init__ |
Undocumented |
Method |
|
Returns a path canonicalized for alphabetical comparison. |
Method |
|
Returns a non-empty error message if the next header is out of order. |
Method |
|
Check if a header has already been included. |
Method |
|
Check if a header is in alphabetical order with the previous header. |
Method |
|
Reset section checking for preprocessor directive. |
Method |
|
Undocumented |
Instance Variable | include |
Undocumented |
Constant | _C |
Undocumented |
Constant | _CPP |
Undocumented |
Constant | _INITIAL |
Undocumented |
Constant | _MY |
Undocumented |
Constant | _OTHER |
Undocumented |
Constant | _SECTION |
Undocumented |
Constant | _TYPE |
Undocumented |
Instance Variable | _last |
Undocumented |
Instance Variable | _section |
Undocumented |
Returns a path canonicalized for alphabetical comparison.
- replaces "-" with "_" so they both cmp the same.
- removes '-inl' since we don't require them to be after the main header.
- lowercase everything, just in case.
- Args:
- header_path: Path to be canonicalized.
- Returns:
- Canonicalized path.
Returns a non-empty error message if the next header is out of order.
This function also updates the internal state to be ready to check the next include.
- Args:
- header_type: One of the _XXX_HEADER constants defined above.
- Returns:
- The empty string if the header is in the right order, or an error message describing what's wrong.
Check if a header has already been included.
- Args:
- header: header to check.
- Returns:
- Line number of previous occurrence, or -1 if the header has not been seen before.
Check if a header is in alphabetical order with the previous header.
- Args:
- clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. header_path: Canonicalized header to be checked.
- Returns:
- Returns true if the header is in alphabetical order.
Reset section checking for preprocessor directive.
- Args:
- directive: preprocessor directive (e.g. "if", "else").
Undocumented
Value |
|
Undocumented
Value |
|