timlawrenz commited on
Commit
0e0540e
·
verified ·
1 Parent(s): d137fb3

Upload scripts/check_syntax.rb with huggingface_hub

Browse files
Files changed (1) hide show
  1. scripts/check_syntax.rb +14 -0
scripts/check_syntax.rb ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'parser/current'
5
+
6
+ # Reads code from stdin and exits with 0 if syntax is valid, 1 otherwise.
7
+ begin
8
+ code = $stdin.read
9
+ Parser::CurrentRuby.parse(code)
10
+ exit 0
11
+ rescue Parser::SyntaxError => e
12
+ $stderr.puts e.message
13
+ exit 1
14
+ end