]> granicus.if.org Git - graphviz/commit
use Bison's api.prefix and Flex's prefix instead of name mangling in cgraph
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 25 Aug 2020 01:31:26 +0000 (18:31 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 2 Sep 2020 00:28:02 +0000 (17:28 -0700)
commitcc2cb52756f545d6863d6fd801fa23762a81704c
tree9287bd7e81a850f7fe4fd96870cb0250a6bf9489
parent4a13c9598ad3d950a251e5d3e5be8d05c59c6214
use Bison's api.prefix and Flex's prefix instead of name mangling in cgraph

Related to !1523. Bison's api.prefix was introduced in 2.6, but switched to
using this bracing syntax in 3.0. Quoting from the Bison 3.0 release notes:

  ** Types of values for %define variables

  Bison used to make no difference between '%define foo bar' and '%define
  foo "bar"'.  The former is now called a 'keyword value', and the latter a
  'string value'.  A third kind was added: 'code values', such as '%define
  foo {bar}'.

  Keyword variables are used for fixed value sets, e.g.,

    %define lr.type lalr

  Code variables are used for value in the target language, e.g.,

    %define api.value.type {struct semantic_type}

  String variables are used remaining cases, e.g. file names.

The Flex option prefix was introduced in Flex 2.4.1 (November 1993) and then
stabilized around 2.5.2 (April 1995). It provides similar functionality:

  ‘-PPREFIX, --prefix=PREFIX, %option prefix="PREFIX"’

  changes the default ‘yy’ prefix used by flex for all globally-visible variable
  and function names to instead be ‘PREFIX’. For example, ‘--prefix=foo’ changes
  the name of yytext to footext. It also changes the name of the default output
  file from lex.yy.c to lex.foo.c.

It would have been nicer to split the lexer and parser changes into separate
commits. However, the MSBuild build does no name mangling here (see
lib/cgraph/cgraph.vcxproj), so changing one of these immediately broke the other
one there. On the positive side, this commit has the effect of realigning some
MSBuild outputs with the Autotools build, as the cgraph lexer and parser are now
aag-prefixed there as well.
lib/cgraph/Makefile.am
lib/cgraph/grammar.y
lib/cgraph/scan.l