danieldietrich / xtext-protected-regions

Xtext Protected Regions
danieldietrich.net
12 stars 6 forks source link

Create Xtend GeneratorExtensions #9

Open danieldietrich opened 13 years ago

danieldietrich commented 13 years ago

A generator extension for Protected Regions Support (PRS) should support the developer in the following way:

  1. provide a unique id generator which returns stable id's even if files are moved / renamed, though the use of this generator should be optional
    • salt.id will become some.voodoo.magic.with.salt
      1. provide language specific protected region generators:
    • «protected(id).java» will become /*PROTECTED REGION ID(id) ENABLED START*/
    • «protected(id,false).java» will become /*PROTECTED REGION ID(id) START*/
    • «protected.java» will become /*PROTECTED REGION END*/
    • «protected(id).xml» will become <!-- PROTECTED REGION ID(id) ENABLED START -->
    • «protected.xml» will become <!-- PROTECTED REGION END -->
    • «generated(id).java» will become /*GENERATED ID(id) ENABLED START*/
    • «generated(id,false).java» will become /*GENERATED ID(id) START*/
    • «generated.java» will become /*GENERATED END*/
danieldietrich commented 12 years ago

Added convinient way to set output paths.

Just import GeneratorExtensions:

import static extension net.danieldietrich.protectedregions.xtext.GeneratorExtensions.*

and then...

fsa.setOutputPaths(
    "xpr-gen1" -> "./xpr-gen1",
    "xpr-gen2" -> "./xpr-gen2"
)

(ProtectedRegionInMemoryFileSystemAccess needs dirs ending with '/')