Skip to content
This repository has been archived by the owner on May 25, 2020. It is now read-only.

Commit

Permalink
Minor changes to import ordering and parser-test output now sends e…
Browse files Browse the repository at this point in the history
…rrors to correct streams; and emits error message (along with error code) when arguments aren't provided
  • Loading branch information
SamuelMarks committed Jul 6, 2015
1 parent b62d65e commit 99a1c24
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ test/Testing/
.ninja_log
build.ninja
rules.ninja

CMakeLists.txt.user
3 changes: 2 additions & 1 deletion src/pypa/ast/dump.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <cassert>

#include <pypa/ast/visitor.hh>
#include <pypa/ast/tree_walker.hh>
#include <cassert>

namespace pypa {

Expand Down
2 changes: 1 addition & 1 deletion src/pypa/filebuf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#endif
#include <stdio.h>
#include <cstdio>

namespace pypa {

Expand Down
3 changes: 2 additions & 1 deletion src/pypa/filebuf.hh
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
#ifndef GUARD_PYPA_FILEBUF_HH_INCLUDED
#define GUARD_PYPA_FILEBUF_HH_INCLUDED

#include <pypa/reader.hh>
#include <cstddef>
#include <string>

#include <pypa/reader.hh>

namespace pypa {

#if defined(WIN32)
Expand Down
7 changes: 4 additions & 3 deletions src/pypa/lexer/lexer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <stack>
#include <cassert>
#include <fstream>

#include <pypa/lexer/lexer.hh>
#include <pypa/lexer/op.hh>
#include <pypa/lexer/keyword.hh>
#include <pypa/lexer/delim.hh>
#include <pypa/filebuf.hh>
#include <stack>
#include <cassert>
#include <fstream>

namespace pypa {
inline bool is_ident_char(char c, bool first = false) {
Expand Down
7 changes: 4 additions & 3 deletions src/pypa/lexer/lexer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@
#ifndef GUARD_PYPA_TOKENIZER_LEXER_HH_INCLUDED
#define GUARD_PYPA_TOKENIZER_LEXER_HH_INCLUDED

#include <pypa/reader.hh>
#include <pypa/lexer/tokendef.hh>
#include <string>
#include <deque>
#include <list>
#include <vector>
#include <stdint.h>
#include <cstdint>
#include <memory>

#include <pypa/reader.hh>
#include <pypa/lexer/tokendef.hh>

namespace pypa {

struct TokenInfo {
Expand Down
3 changes: 2 additions & 1 deletion src/pypa/parser/make_string.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <pypa/types.hh>
#include <cassert>

#include <pypa/types.hh>

namespace pypa {

inline bool isxdigit(char c) {
Expand Down
5 changes: 4 additions & 1 deletion src/pypa/parser/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include <cassert>

#include <gmp.h>

#include <pypa/parser/apply.hh>
#include <pypa/parser/parser_fwd.hh>
#include <double-conversion/src/double-conversion.h>
#include <pypa/ast/context_assign.hh>
#include <cassert>

namespace pypa {

Expand Down
3 changes: 2 additions & 1 deletion src/pypa/parser/parser.hh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
#ifndef GUARD_PYPA_PARSER_PARSER_HH_INCLUDED
#define GUARD_PYPA_PARSER_PARSER_HH_INCLUDED

#include <functional>

#include <pypa/ast/ast.hh>
#include <pypa/lexer/lexer.hh>
#include <pypa/parser/symbol_table.hh>
#include <pypa/types.hh>
#include <functional>

namespace pypa {

Expand Down
3 changes: 2 additions & 1 deletion src/pypa/parser/symbol_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <cassert>

#include <pypa/parser/symbol_table.hh>
#include <pypa/parser/symbol_table_visitor.hh>
#include <pypa/ast/tree_walker.hh>
#include <cassert>

namespace pypa {
void SymbolTable::enter_block(BlockType type, String const & name, Ast & a) {
Expand Down
7 changes: 5 additions & 2 deletions src/pypa/parser/test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include <cstdio>

#include <pypa/parser/parser.hh>
#include <stdio.h>

namespace pypa {
void dump(AstPtr);
}

int main(int argc, char const ** argv) {
if(argc != 2) {
fprintf(stderr, "Usage: %s <python_file_path>\n", argv[0]);
return 1;
}
pypa::AstModulePtr ast;
Expand All @@ -34,7 +37,7 @@ int main(int argc, char const ** argv) {
dump(ast);
}
else {
printf("Parsing failed\n");
fprintf(stderr, "Parsing failed\n");
return 1;
}
return 0;
Expand Down

0 comments on commit 99a1c24

Please sign in to comment.