Skip to content

RelativeSource

RelativeSource represents an embedded source element within a larger source.

  • Source

new RelativeSource(options): RelativeSource

constructor configures an embedded policy source.

RelativeSourceOptions

RelativeSource

containingSource(): Source

containingSource returns the complete policy source containing this expression.

Source


content(): string

content returns the embedded source snippet.

string

CommonSource.content


description(): string

description returns the containing source description.

string

CommonSource.description


lineOffsets(): number[]

lineOffsets returns line offsets for the containing source.

number[]

CommonSource.lineOffsets


location(line, column): Location

location translates an embedded line and column to an absolute location.

number

number

Location

CommonSource.location


locationOffset(location): [number, boolean]

locationOffset translates an absolute location to a containing-source offset.

Location

[number, boolean]

CommonSource.locationOffset


offsetLocation(offset): [Location, boolean]

offsetLocation returns the absolute location for a relative offset, if found.

number

[Location, boolean]

CommonSource.offsetLocation


snippet(line): [string, boolean]

snippet returns a line from the containing policy source.

number

[string, boolean]

CommonSource.snippet