D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
SyntaxSuggest
/
CodeFrontier
/
Filename :
cdesc-CodeFrontier.ri
back
Copy
U:RDoc::NormalClass[iI"CodeFrontier:ETI" SyntaxSuggest::CodeFrontier;TI"Object;To:RDoc::Markup::Document:@parts[o;;[ o:RDoc::Markup::Paragraph;[I"2There are three main phases in the algorithm:;To:RDoc::Markup::BlankLine o:RDoc::Markup::List: @type:NUMBER:@items[o:RDoc::Markup::ListItem:@label0;[o; ;[I"!Sanitize/format input source;To;;0;[o; ;[I"Search for invalid blocks;To;;0;[o; ;[I"4Format invalid blocks into something meaningful;T@o; ;[I"<The Code frontier is a critical part of the second step;T@o; ;[I" ## Knowing where we've been;T@o; ;[I"SOnce a code block is generated it is added onto the frontier. Then it will be ;TI"[sorted by indentation and frontier can be filtered. Large blocks that fully enclose a ;TI">smaller block will cause the smaller block to be evicted.;T@o:RDoc::Markup::Verbatim;[I"5CodeFrontier#<<(block) # Adds block to frontier ;TI"4CodeFrontier#pop # Removes block from frontier ;T:@format0o; ;[I"## Knowing where we can go;T@o; ;[I"gInternally the frontier keeps track of "unvisited" lines which are exposed via `next_indent_line` ;TI"Swhen called, this method returns, a line of code with the highest indentation.;T@o; ;[I"YThe returned line of code can be used to build a CodeBlock and then that code block ;TI"Iis added back to the frontier. Then, the lines are removed from the ;TI":"unvisited" so we don't double-create the same block.;T@o;;[I"5CodeFrontier#next_indent_line # Shows next line ;TI"NCodeFrontier#register_indent_block(block) # Removes lines from unvisited ;T;0o; ;[I"## Knowing when to stop;T@o; ;[ I"YThe frontier knows how to check the entire document for a syntax error. When blocks ;TI"^are added onto the frontier, they're removed from the document. When all code containing ;TI"[syntax errors has been added to the frontier, the document will be parsable without a ;TI"*syntax error and the search can stop.;T@o;;[I"`CodeFrontier#holds_all_syntax_errors? # Returns true when frontier holds all syntax errors ;T;0o; ;[I"!## Filtering false positives;T@o; ;[I"]Once the search is completed, the frontier may have multiple blocks that do not contain ;TI"[the syntax error. To limit the result to the smallest subset of "invalid blocks" call:;T@o;;[I"'CodeFrontier#detect_invalid_blocks;T;0: @fileI"(lib/syntax_suggest/code_frontier.rb;T:0@omit_headings_from_table_of_contents_below0;0;0[ [ [ [[I" class;T[[:public[[I"combination;TI"(lib/syntax_suggest/code_frontier.rb;T[I"new;T@d[:protected[ [:private[ [I" instance;T[[;[[I"<<;T@d[I" count;T@d[I"detect_invalid_blocks;T@d[I"expand?;T@d[I"holds_all_syntax_errors?;T@d[I"next_indent_line;T@d[I"pop;T@d[I"register_engulf_block;T@d[I"register_indent_block;T@d[;[ [;[[I"can_skip_check?;T@d[ [U:RDoc::Context::Section[i 0o;;[ ;0;0[@XI"SyntaxSuggest;TcRDoc::NormalModule