MCPcopy Create free account
hub / github.com/YosysHQ/nextpnr / process

Method process

3rdparty/python-console/ParseHelper.cpp:74–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72{ }
73
74void ParseHelper::process( const std::string& str )
75{
76 std::string top;
77 commandBuffer.push_back(str);
78 //std::string top = commandBuffer.back();
79 //commandBuffer.pop_back();
80 std::shared_ptr<ParseState> blockStatePtr;
81 while (stateStack.size())
82 {
83 top = commandBuffer.back();
84 commandBuffer.pop_back();
85 blockStatePtr = stateStack.back();
86 if (blockStatePtr->process(top))
87 return;
88 }
89
90 if ( ! commandBuffer.size() )
91 return;
92
93 // standard state
94 top = commandBuffer.back();
95 if ( !top.size() )
96 {
97 reset( );
98 broadcast( std::string() );
99 return;
100 }
101
102 { // check for unexpected indent
103 Indent ind;
104 bool isIndented = PeekIndent( top, &ind );
105 if ( isIndented &&
106 ! isInContinuation( ) )
107 {
108 reset( );
109 ParseMessage msg( 1, "IndentationError: unexpected indent");
110 broadcast( msg );
111 return;
112 }
113 }
114
115 // enter indented block state
116 if ( top[top.size()-1] == ':' )
117 {
118 std::shared_ptr<ParseState> parseState(
119 new BlockParseState( *this ) );
120 stateStack.push_back( parseState );
121 return;
122 }
123
124 if ( top[top.size()-1] == '\\' )
125 {
126 std::shared_ptr<ParseState> parseState(
127 new ContinuationParseState( *this ) );
128 stateStack.push_back( parseState );
129 return;
130 }
131

Callers 4

mainFunction · 0.45
handleReturnKeyPressMethod · 0.45
mainFunction · 0.45
editLineReturnPressedMethod · 0.45

Calls 6

resetFunction · 0.85
broadcastFunction · 0.85
push_backMethod · 0.80
backMethod · 0.80
pop_backMethod · 0.80
sizeMethod · 0.45

Tested by 2

mainFunction · 0.36
mainFunction · 0.36