BUILD 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. licenses(["notice"])
  2. load("@rules_ragel//ragel:ragel.bzl", "ragel")
  3. load("@rules_bison//bison:bison.bzl", "bison")
  4. ragel(
  5. name = "ragel_lexer",
  6. src = "cc/lexer.rl",
  7. language = "c++",
  8. )
  9. bison(
  10. name = "typedruby_bison",
  11. src = "cc/grammars/typedruby.ypp",
  12. bison_options = [
  13. "-Wno-empty-rule",
  14. "-Wno-precedence",
  15. ],
  16. )
  17. cc_binary(
  18. name = "generate_diagnostics",
  19. srcs = [
  20. "codegen/generate_diagnostics.cc",
  21. ],
  22. linkstatic = select({
  23. "//conditions:default": 1,
  24. }),
  25. visibility = ["//visibility:public"],
  26. )
  27. genrule(
  28. name = "gen_diagnostics_dclass",
  29. outs = [
  30. "include/ruby_parser/diagnostic_class.hh",
  31. ],
  32. cmd = "$(location :generate_diagnostics) dclass > $@",
  33. tools = [
  34. ":generate_diagnostics",
  35. ],
  36. )
  37. cc_library(
  38. name = "parser",
  39. srcs = glob(["cc/*.cc"]) + [
  40. ":gen_diagnostics_dclass",
  41. ":ragel_lexer",
  42. ":typedruby_bison",
  43. ],
  44. hdrs = glob(["include/**/*.hh"]),
  45. copts = [
  46. "-Wno-unused-const-variable",
  47. ],
  48. includes = [
  49. "include",
  50. "include/ruby_parser",
  51. ],
  52. linkstatic = select({
  53. "//conditions:default": 1,
  54. }),
  55. visibility = ["//visibility:public"],
  56. deps = [
  57. "@com_google_absl//absl/strings",
  58. ],
  59. )