Skip to content
grammarware edited this page Jan 23, 2013 · 1 revision

RenameAllN is a grammar mutation that enforces the use of a particular naming convention for nonterminal symbols. A naming convention is characterised by specifying two parameters: its capitalisation policy and a word separator.

Possible capitalisation policy:

  • UPPERCASE
  • lowercase
  • mixedCase
  • CamelCase

A separator is just a string

RenameAll implementations

There are three different implementations of RenameAll, varying in authorship, robustness and usage.

Four modes of operating:

  • 1: convert everything to UPPERCASE
  • 2: convert everything to lowercase
  • 3: convert the first character to Uppercase
  • 4: convert the first character to lowerCase

Any other combination is not implemented, and nonterminal names are perceived as containing one word each.

Implements all for capitalisation policies and separators that are:

  • any one letter (usually -, _ or .)
  • !, meaning no separation
  • s, meaning whitespace separation

(Using s to denote space makes sense since no naming conventions have been observed as having the actual letter “s” as a separator, and the expected use of the implementation as a command line tool).

Obviously, if the source naming convention is uppercase or lowercase without separators, no multiword names will be detected and processed correctly (advanced dictionary-based methods are required).

Defines an ADT for capitalisation policy and uses any (possibly empty) string as a separator. Contains a universal function, as well as several other pre-encoded functions to use together with the unified mutate() function. For instance, there are:

  • changeDashedUpper2GluedCamelN
  • changeDashedLower2GluedCamelN
  • changeDashedUpper2GluedMixedN
  • changeDashedLower2GluedMixedN

Relevant files

Contributors

Clone this wiki locally