Ignore:
Timestamp:
Jul 3, 2020, 7:19:17 PM (4 years ago)
Author:
coas-nagasima
Message:

ASP3, TINET, mbed を更新

File:
1 edited

Legend:

Unmodified
Added
Removed
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/core/bnf.y.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2016 by TOPPERS Project
     6#   Copyright (C) 2008-2018 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    378378        | STRUCT
    379379                {
    380                         result = StructType.new()
     380                        # tag が無い場合、内部名を与える
     381                        result = StructType.new( :"TAG__#{@@no_struct_tag_num}__" )
     382                        @@no_struct_tag_num += 1
    381383                        StructType.set_define( true )
    382384                }
     
    709711        : component_description specified_statement
    710712        | component_description location_information
     713        | component_description tool_info
    711714        |
    712715
     
    738741        | import
    739742        | import_C
    740         | signature_plugin
     743        | generate_statement
    741744        | error   # エラー回復ポイント
    742745
     
    797800
    798801region_name_list
    799         : IDENTIFIER
    800                 {       result = [val[0].val]           }
    801         | region_name_list ',' IDENTIFIER
    802                 {       result << val[2].val            }
     802        : namespace_identifier
     803                {       result = [val[0]]               }
     804        | region_name_list ',' namespace_identifier
     805                {       result << val[2]                }
    803806
    804807const_statement
     
    832835                { Import.new( val[2], true ) }
    833836
    834 signature_plugin
     837generate_statement
    835838#        : GENERATE '(' plugin_name ',' namespace_identifier ',' STRING_LITERAL ')' ';'  #1ok signature plugin
    836839        : GENERATE '(' plugin_name ',' namespace_identifier ',' plugin_arg ')' ';'  #1ok signature plugin
     
    13011304                        result = [ val[0] ]
    13021305                }
     1306        | composite_celltype_statement_specifier_list ',' composite_celltype_statement_specifier
     1307                {
     1308                        Generator.add_statement_specifier val[2]
     1309                        result = val[0] << val[2]
     1310                }
    13031311
    13041312composite_celltype_statement_specifier
     
    13501358        | internal_join_list specified_join
    13511359        | internal_join_list external_join
     1360        | internal_join_list reverse_join
    13521361
    13531362external_join  # cell 内に記述する呼び口の外部結合
     
    14991508
    15001509
     1510#  JSON object
     1511tool_info        : TOOL_INFO '(' JSON_string ')' JSON_object { TOOL_INFO.new( val[2].to_sym, val[4] ) }
     1512JSON_object      : '{' JSON_property_list   '}'              {  result = val[1] }
     1513JSON_property_list : JSON_string ':' JSON_value              { result = { val[0].to_sym => val[2] } }
     1514                 | JSON_property_list ',' JSON_string ':' JSON_value
     1515                                                             { val[0][ val[2].to_sym ] = val[4] }
     1516JSON_value       : JSON_string | JSON_number | JSON_object | JSON_array
     1517                 | TRUE { result=val[0].val } | FALSE  { result=val[0].val } # JSON_NULL # null not suppoted
     1518JSON_array       : '[' JSON_array_list ']'                   { result = val[1]  }
     1519                 | '['  ']'                                  { result = []  }
     1520JSON_array_list  : JSON_value                                { result = [ val[0] ] }
     1521                 | JSON_array_list ',' JSON_value            { val[0] << val[2] }
     1522JSON_string      : STRING_LITERAL                            { result = val[0].val.gsub!( /\"(.*)\"/, "\\1" ) }
     1523JSON_number      : INTEGER_CONSTANT                          { result = val[0].val.to_i }
     1524                 | FLOATING_CONSTANT                         { result = val[0].val.to_f }
     1525                 | '-' INTEGER_CONSTANT                      { result = - val[0].val.to_i }
     1526                 | '-' FLOATING_CONSTANT                     { result = - val[0].val.to_f }
     1527                 | '+' INTEGER_CONSTANT                      { result = val[0].val.to_i }
     1528                 | '+' FLOATING_CONSTANT                     { result = val[0].val.to_f }
     1529
     1530
    15011531end
    15021532
     
    15231553    'import_C' => :IMPORT_C,
    15241554    'generate' => :GENERATE,
     1555    '__tool_info__' => :TOOL_INFO,
    15251556
    15261557    # types
     
    16581689  # すべての構文解析が完了した
    16591690  @@b_end_all_parse = false
     1691
     1692  # tag なし struct
     1693  @@no_struct_tag_num = 0
    16601694
    16611695  def self.parse( file_name, plugin = nil, b_reuse = false )
     
    17731807                  string += line
    17741808                  # この位置では error メソッドは使えない (token 読出し前)
    1775                   puts "error: #{file} line #{lineno}: string literal has newline without escape"
     1809                  puts "#{file}:#{lineno}:#{col}: error: string literal has newline without escape"
    17761810                  @@n_error += 1
    17771811                end
     
    18141848                  b_in_string = true
    18151849                  # この位置では error メソッドは使えない (token 読出し前) # mikan cdl_error ではない
    1816                   puts "error: #{file} line #{lineno}: string literal has newline without escape"
     1850                  puts "#{file}:#{lineno}:#{col}: error: string literal has newline without escape"
    18171851                  @@n_error += 1
    18181852                # 山括弧で囲まれた文字列
    1819                 when /\A<[0-9A-Za-z_\. \/]+>/   # AB: angle bracke
     1853                # when /\A<[0-9A-Za-z_\. \/]+>/   # AB: angle bracke
     1854                when /\A<(?:[^>\\]|\\.)*>/   # これはうまく行くようだ
    18201855                  @q << [:AB_STRING_LITERAL, Token.new($&, file, lineno, col)]
    18211856                # 行コメント
     
    19131948  @@n_error = 0
    19141949  @@n_warning = 0
     1950  @@n_info = 0
    19151951
    19161952  # このメソッドは構文解析、意味解析からのみ呼出し可(コード生成でエラー発生は不適切)
     
    19461982      end
    19471983      if locale then
    1948         Console.puts "error: #{locale[0]}: line #{locale[1]} #{msg}"
     1984        Console.puts "#{locale[0]}:#{locale[1]}:#{locale[2]}: error: #{msg}"
    19491985      else
    19501986        Console.puts "error: #{msg}"
     
    19792015      end
    19802016      if locale then
    1981         Console.puts "warning: #{locale[0]}: line #{locale[1]} #{msg}"
     2017        Console.puts "#{locale[0]}:#{locale[1]}:#{locale[2]}: warning: #{msg}"
    19822018      else
    19832019        Console.puts "warning: #{msg}"
     
    19862022  end
    19872023
     2024  # このメソッドは構文解析、意味解析からのみ呼出し可
     2025  def self.info( msg, *arg )
     2026    locale = nil
     2027    self.info2( locale, msg, *arg )
     2028  end
     2029
     2030  def self.info2( locale, msg, *arg )
     2031    @@n_info += 1
     2032
     2033    msg = TECSMsg.get_info_message( msg )
     2034    # $1, $2, ... を arg で置換
     2035    count = 1
     2036    arg.each{ |a|
     2037      str = TECSIO.str_code_convert( msg, a.to_s )
     2038      msg.sub!( /\$#{count}/, str )
     2039      count += 1
     2040    }
     2041
     2042    # import_C の中でのウォーニング?
     2043    if @@import_C then
     2044      C_parser.info( msg )
     2045    else
     2046      if @@b_end_all_parse == false || locale == nil then
     2047        locale = @@current_locale[ @@generator_nest ]
     2048      end
     2049      if locale then
     2050        Console.puts "#{locale[0]}:#{locale[1]}:#{locale[2]}: info: #{msg}"
     2051      else
     2052        Console.puts "info: #{msg}"
     2053      end
     2054    end
     2055  end
     2056
    19882057  def self.get_n_error
    19892058    @@n_error
     
    19942063  end
    19952064
     2065  def self.get_n_info
     2066    @@n_info
     2067  end
     2068
    19962069  def self.get_nest
    19972070    @@generator_nest
     2071  end
     2072
     2073  def self.parsing_C?
     2074    @@import_C
    19982075  end
    19992076
Note: See TracChangeset for help on using the changeset viewer.