CPC G06F 8/427 (2013.01) [G06F 8/33 (2013.01); G06F 8/433 (2013.01)] | 20 Claims |
1. A method, implemented at a computer system that includes a processor, for inferring source code structure based on indentation, the method comprising:
identifying a portion of source code comprising a plurality of lines;
determining a corresponding indentation level for each line in the plurality of lines;
generating a plurality of nodes that each represents a different line in the plurality of lines;
arranging the plurality of nodes into an ordered tree based at least on the corresponding indentation level for each line in the plurality of lines;
based on an identified line in the plurality of lines:
identifying, from the ordered tree, a subtree that comprises a node representing the identified line;
identifying a subset of the plurality of nodes that correspond to the subtree; and
identifying a subset of the plurality of lines that are represented by the subset of the plurality of nodes as being syntactically-related to the identified line; and
initiating a source code action based on the subset of the plurality of lines.
|