So just insert an `is`, and move it after the initial value if any.
~~~
sed -i '/ is /!s/\(\( redef\)\?\( protected\)\? writable\)\(.*\)/\4 is\1/'
~~~
Signed-off-by: Jean Privat <jean@pryen.org>
# Is self transformed to a other production for the AST
# FIXME: cleaup AST
- var spe: nullable Production writable = null
+ var spe: nullable Production = null is writable
# Is self contains only a single alternative (then no need for a abstract production class in the AST)
# FIXME cleanup AST
- var altone writable = false
+ var altone = false is writable
# The cname of the class in the AST
# FIXME: cleanup AST
var prod: Production
# The name of the alternative
- var name: String writable
+ var name: String is writable
# The elements of the alternative
var elems: Array[Element]
end
# The code for the reduction
- var codes: nullable Array[Code] writable = null
+ var codes: nullable Array[Code] = null is writable
# Is the alternative transformed (ie not in the AST)
- var trans writable = false
+ var trans = false is writable
# Is the alternative unparsable? (ie not in the automaton)
- var phony writable = false
+ var phony = false is writable
# Imitialize codes with the elements
fun make_codes
class ASTPrinter
super Visitor
- var str writable = ""
+ var str = "" is writable
init do end
redef fun visit(n) do n.accept_ast_printer(self)
end
end
- var watchdog writable = 0
+ var watchdog = 0 is writable
fun link_ret_to_calls(b: BasicBlock, to_link_ori: List[BasicBlock], seq: List[BasicBlock], depth: Int): Bool
do
watchdog += 1
# State of the parser automata as stored in the parser stack.
private class State
# The internal state number
- readable writable var _state: Int
+ readable var _state: Int is writable
# The node stored with the state in the stack
- readable writable var _nodes: nullable Object
+ readable var _nodes: nullable Object is writable
init(state: Int, nodes: nullable Object)
do
# The value indicate the number of step that remain to be stunt
#
# If a animal is stunned, it cannot move horizontally
- var stunt_ttl: Int writable = 0
+ var stunt_ttl: Int = 0 is writable
# Common update for animal
# handle stunt and edge collision
class MovingEntity
super Entity
- var going_to : nullable GamePos writable = null
+ var going_to : nullable GamePos = null is writable
fun speed : Int is abstract
end
# Current forture of the player
- var money: Int writable = 0
+ var money: Int = 0 is writable
# Number of basic bullets fired together
- var nbshoots: Int writable = 1
+ var nbshoots: Int = 1 is writable
# Time bebore the player shoot again a basic bullet (cooldown)
# Shoot if 0
var shoot_ttl = 0
# Number of missiles
- var nbmissiles: Int writable = 0
+ var nbmissiles: Int = 0 is writable
# Time bebore the player shoot again a missile (cooldown)
# Shoot if 0
super Hitable
# true in on move, false if player is at rest
- var active writable = false
+ var active = false is writable
init do
self.width = 500
super Scene
# When a scene need to be replaced, just assign the next_scene to a non null value
- var next_scene: nullable ShotScene writable = null
+ var next_scene: nullable ShotScene = null is writable
# The width of the whole scene
- var width: Int writable
+ var width: Int is writable
# The height of the whole scene
- var height: Int writable
+ var height: Int is writable
init(w,h: Int)
do
end
end
- var play: Bool writable = false
+ var play: Bool = false is writable
var ttl: Int = 50
redef fun update
class SoundPool
private var nsoundpool: NativeSoundPool is noinit
# The maximum number of simultaneous streams for this SoundPool
- var max_streams writable = 10
+ var max_streams = 10 is writable
# The audio stream type, 3 is STREAM_MUSIC, default for game application
- var stream_type writable = 3
+ var stream_type = 3 is writable
# The sample-rate converter quality, currently has no effect
- var src_quality writable = 0
+ var src_quality = 0 is writable
# Left volume value, range 0.0 to 1.0
- var left_volume writable = 1.0
+ var left_volume = 1.0 is writable
# Right volume value, range 0.0 to 1.0
- var right_volume writable = 1.0
+ var right_volume = 1.0 is writable
# Playback rate, 1.0 = normal playback, range 0.5 to 2.0
- var rate writable = 1.0
+ var rate = 1.0 is writable
# Loop mode, 0 = no loop, -1 = loop forever
- var looping writable = 0
+ var looping = 0 is writable
# Stream priority
private var priority = 1
# NIT representation of an Android Sensor used in android_app to initialize sensors
class AndroidSensor
- var asensor writable = new ASensor
- var enabled writable = false
- var event_rate writable = 100000
+ var asensor = new ASensor is writable
+ var enabled = false is writable
+ var event_rate = 100000 is writable
fun name: String do return asensor.name.to_s
fun vendor: String do return asensor.vendor.to_s
var proximity = new AndroidSensor
var sensormanager: ASensorManager
var eventqueue: ASensorEventQueue
- var sensors_support_enabled writable = false
+ var sensors_support_enabled = false is writable
private fun extern_input_sensor_accelerometer(event: ASensorAccelerometer) do input(event)
private fun extern_input_sensor_magnetic_field(event: ASensorMagneticField) do input(event)
# Game logic on the client
class ThinGame
- var tick: Int protected writable = 0
+ var tick: Int = 0 is protected writable
end
# Game turn on the client
class ThinGameTurn[G: ThinGame]
- var tick: Int protected writable = 0
+ var tick: Int = 0 is protected writable
- var events: List[GameEvent] protected writable = new List[GameEvent]
+ var events: List[GameEvent] = new List[GameEvent] is protected writable
init (t: Int) do tick = t
end
class CSVDocument
super Streamable
- var header: Array[String] writable = new Array[String]
+ var header: Array[String] = new Array[String] is writable
var lines: Array[Array[String]] = new Array[Array[String]]
fun set_header(values: Object...) do
# CURL Request
class CurlRequest
- var verbose: Bool writable = false
+ var verbose: Bool = false is writable
private var curl: nullable Curl = null
# Launch request method
super CurlCallbacksRegisterIntern
var url: String
- var datas: nullable HeaderMap writable = null
- var headers: nullable HeaderMap writable = null
+ var datas: nullable HeaderMap = null is writable
+ var headers: nullable HeaderMap = null is writable
# Set the user agent for all following HTTP requests
fun user_agent=(name: String)
super CurlRequest
super CCurlCallbacks
- var headers: nullable HeaderMap writable = null
- var headers_body: nullable HeaderMap writable = null
- var from: nullable String writable = null
- var to: nullable Array[String] writable = null
- var cc: nullable Array[String] writable = null
- var bcc: nullable Array[String] writable = null
- var subject: nullable String writable = ""
- var body: nullable String writable = ""
+ var headers: nullable HeaderMap = null is writable
+ var headers_body: nullable HeaderMap = null is writable
+ var from: nullable String = null is writable
+ var to: nullable Array[String] = null is writable
+ var cc: nullable Array[String] = null is writable
+ var bcc: nullable Array[String] = null is writable
+ var subject: nullable String = "" is writable
+ var body: nullable String = "" is writable
private var supported_outgoing_protocol: Array[String] = ["smtp", "smtps"]
init (curl: nullable Curl)
# Callbacks attributes
abstract class CurlCallbacksRegisterIntern
- var delegate: nullable CurlCallbacks writable = null
+ var delegate: nullable CurlCallbacks = null is writable
end
# Abstract Curl request response
# The second element to compare
var b: E
# The result of the comparison (according to the user)
- var res writable = 0
+ var res = 0 is writable
end
# Abuser for sorting array, see `sort_fa`
private class ConfigNode
var parent: nullable ConfigNode
var children = new HashMap[String, ConfigNode]
- var name: String writable
+ var name: String is writable
var value: nullable String
init(name: String) do
# Display to use by apps
# Is null if the display is not available or not yet ready
- var display: nullable D protected writable = null
+ var display: nullable D = null is protected writable
# Received quit order
- var quit: Bool writable = false
+ var quit: Bool = false is writable
# App is visible? (vs minimized or in background)
fun visible: Bool is abstract
# Zero (or a negative value) means no limit.
#
# Applications can modify this value even during the main-loop.
- var maximum_fps writable = 60
+ var maximum_fps = 60 is writable
# Current frame-rate
# Updated each 5 seconds.
super Image
var path: String
redef fun to_s do return path
- redef var scale redef writable = 1.0
+ redef var scale = 1.0 is redef writable
redef var width = 32
redef var height = 32
end
# Additional space to insert horizontally between characters
# A negave value will display tile overlaped
- var hspace: Int writable = 0
+ var hspace: Int = 0 is writable
# Additional space to insert vertically between characters
# A negave value will display tile overlaped
- var vspace: Int writable = 0
+ var vspace: Int = 0 is writable
# The glyph (tile) associated to the caracter `c` according to `chars`
# Returns null if `c` is not in `chars`
end
# OAuth token
- var auth: nullable String writable
+ var auth: nullable String is writable
# User agent (is used by github to contact devs in case of problems)
# Eg. "Awesome-Octocat-App"
- var user_agent: nullable String writable
+ var user_agent: nullable String is writable
# HTTP headers to send
- var headers: nullable HeaderMap writable = null
+ var headers: nullable HeaderMap = null is writable
# init HTTP headers for Neo4j REST API
class JsonPOST
super JsonCurlRequest
- var data: nullable Jsonable writable = null
+ var data: nullable Jsonable = null is writable
redef fun init_headers do
super
class JsonPUT
super JsonCurlRequest
- var data: nullable Jsonable writable = null
+ var data: nullable Jsonable = null is writable
redef fun init_headers do
super
# Should the parser stop
# Used by generated parsers
- var stop writable = true
+ var stop = true is writable
# Parse a full sequence of tokens and return a complete syntactic tree
fun parse: Node
end
# The position of the node in the input stream
- var position: nullable Position writable = null
+ var position: nullable Position = null is writable
# Produce a graphiz file for the syntaxtic tree rooted at `self`.
fun to_dot(filepath: String)
end
# The text associated with the token
- var text: String writable = ""
+ var text: String = "" is writable
redef fun to_s do
var res = super
var errors: Array[String] = new Array[String]
# Is this option mandatory?
- var mandatory: Bool writable = false
+ var mandatory: Bool = false is writable
# Is this option hidden from `usage`?
- var hidden: Bool writable = false
+ var hidden: Bool = false is writable
# Has this option been read?
- var read: Bool writable = false
+ var read: Bool = false is writable
# Current value of this option
- var value: VALUE writable
+ var value: VALUE is writable
# Default value of this option
- var default_value: VALUE writable
+ var default_value: VALUE is writable
# Create a new option
init(help: String, default: VALUE, names: nullable Array[String])
protected fun convert(str: String): VALUE is abstract
# Is the parameter mandatory?
- var parameter_mandatory: Bool writable = true
+ var parameter_mandatory: Bool = true is writable
redef fun read_param(it)
do
fun update do end
# Controls whether `update' and `draw' are automatically called by `LiveGroup'
- var exists writable = true
+ var exists = true is writable
# Redefine this method to asks how to draw on a view
fun draw(view: View) is abstract
super LiveObject
# x coordinate of the center point
- var x: Int writable = 0
+ var x: Int = 0 is writable
# y coordinate of the center point
- var y: Int writable = 0
+ var y: Int = 0 is writable
# width of the sprite
- var width: Int writable = 100
+ var width: Int = 100 is writable
# height of the sprite
- var height: Int writable = 100
+ var height: Int = 100 is writable
fun left: Int do return x - width/2
fun right: Int do return x + width/2
fun bottom: Int do return y + height/2
# x velocity (applied by `update')
- var vx: Int writable = 0
+ var vx: Int = 0 is writable
# y velocity (applied by `update')
- var vy: Int writable = 0
+ var vy: Int = 0 is writable
redef fun update
do
init(e: E) do item = e
# The stored item
- var item: E writable
+ var item: E is writable
end
# This iterator is quite stupid since it is used for only one item.
class Couple[F, S]
# The first element of the couple.
- var first: F writable
+ var first: F is writable
# The second element of the couple.
- var second: S writable
+ var second: S is writable
# Create a new instance with a first and a second object.
init(f: F, s: S)
redef class Sys
# Standard input
- var stdin: PollableIStream protected writable = new Stdin
+ var stdin: PollableIStream = new Stdin is protected writable
# Standard output
- var stdout: OStream protected writable = new Stdout
+ var stdout: OStream = new Stdout is protected writable
# Standard output for errors
- var stderr: OStream protected writable = new Stderr
+ var stderr: OStream = new Stderr is protected writable
end
protected type N: TreeNode[K, E]
# The `root` node of the tree (null if tree is empty)
- protected var root: nullable N protected writable = null
+ protected var root: nullable N = null is protected writable
# Display the tree in a gaphical windows
# Graphviz with a working -Txlib is expected
var value: E
# Direct parent of this node (null if the node is root)
- var parent: nullable SELF writable = null
+ var parent: nullable SELF = null is writable
redef fun to_s do return "\{{value or else ""}\}"
end
redef class MModule
- var c_compiler_options writable = ""
- var c_linker_options writable = ""
+ var c_compiler_options = "" is writable
+ var c_linker_options = "" is writable
end
class ForeignCType
redef class MModule
private var cpp_file: nullable CPPCompilationUnit = null
- var cpp_compiler_options writable = ""
+ var cpp_compiler_options = "" is writable
end
class CPPLanguage
# The main module of the program currently compiled
# Is assigned during the separate compilation
- var mainmodule: MModule writable
+ var mainmodule: MModule is writable
# The real main module of the program
var realmainmodule: MModule
# The modeulbuilder used to know the model and the AST
- var modelbuilder: ModelBuilder protected writable
+ var modelbuilder: ModelBuilder is protected writable
# Is hardening asked? (see --hardening)
fun hardening: Bool do return self.modelbuilder.toolcontext.opt_hardening.value
fun new_visitor: VISITOR is abstract
# Where global declaration are stored (the main .h)
- var header: CodeWriter writable
+ var header: CodeWriter is writable
# Provide a declaration that can be requested (before or latter) by a visitor
fun provide_declaration(key: String, s: String)
var compiler: COMPILER
# The current visited AST node
- var current_node: nullable ANode writable = null
+ var current_node: nullable ANode = null is writable
# The current `Frame`
- var frame: nullable Frame writable
+ var frame: nullable Frame is writable
# Alias for self.compiler.mainmodule.object_type
fun object_type: MClassType do return self.compiler.mainmodule.object_type
# Non cached version of `c_name`
protected fun build_c_name: String is abstract
- protected var c_name_cache: nullable String writable = null
+ protected var c_name_cache: nullable String = null is writable
# Implements a call of the runtime_function
# May inline the body or generate a C function call
var mtype: MType
# The current casted type of the variable (as known in Nit)
- var mcasttype: MType writable
+ var mcasttype: MType is writable
# If the variable exaclty a mcasttype?
# false (usual value) means that the variable is a mcasttype or a subtype.
- var is_exact: Bool writable = false
+ var is_exact: Bool = false is writable
init(name: String, mtype: MType, mcasttype: MType)
do
var arguments: Array[RuntimeVariable]
# The runtime_variable associated to the return (in a function)
- var returnvar: nullable RuntimeVariable writable = null
+ var returnvar: nullable RuntimeVariable = null is writable
# The label at the end of the property
- var returnlabel: nullable String writable = null
+ var returnlabel: nullable String = null is writable
end
redef class MType
# Return the name of the C structure associated to a Nit live type
fun c_name: String is abstract
- protected var c_name_cache: nullable String protected writable
+ protected var c_name_cache: nullable String is protected writable
end
redef class MClassType
# Content to display in the box
# box will not be rendered if the content is null
- var content: nullable Streamable writable
+ var content: nullable Streamable is writable
# Is the box opened by default
# otherwise, the user will have to clic on the title to display the content
- var is_open writable = false
+ var is_open = false is writable
init(title: String) do
self.title = title
# Title to display if any
# if both `title` and `summary_title` are null then
# the section will not appear in the summary
- var title: nullable Streamable writable
+ var title: nullable Streamable is writable
# Subtitle to display if any
- var subtitle: nullable Streamable writable
+ var subtitle: nullable Streamable is writable
# Title that appear in the summary
# if null use `title` instead
- var summary_title: nullable String writable
+ var summary_title: nullable String is writable
# CSS classes to apply on the section element
var css_classes = new Array[String]
super TplSectionElt
# Content for this article
- var content: nullable Streamable writable = null
- var source_link: nullable Streamable writable = null
+ var content: nullable Streamable = null is writable
+ var source_link: nullable Streamable = null is writable
init with_content(id: String, title: Streamable, content: Streamable) do
with_title(id, title)
super Template
# Link href
- var href: String writable
+ var href: String is writable
# Text to display in the link
- var text: Streamable writable
+ var text: Streamable is writable
# Optional title
- var title: nullable String writable
+ var title: nullable String is writable
init(href, text: String) do
self.href = href
# Is the HTML include a nested `<span class"{type_of_node}">` element for each `ANode` of the AST?
# Used to have a really huge and verbose HTML (mainly for debug)
- var with_ast writable = false
+ var with_ast = false is writable
# The first line to generate, null if start at the first line
- var first_line: nullable Int writable = null
+ var first_line: nullable Int = null is writable
# The last line to generate, null if finish at the last line
- var last_line: nullable Int writable = null
+ var last_line: nullable Int = null is writable
init
do
# The entity where the documentation is originally attached to.
# This gives some context to resolve identifiers or to run examples.
- var original_mentity: nullable MEntity writable = null
+ var original_mentity: nullable MEntity = null is writable
end
redef class MEntity
# The documentation assiciated to the entity
- var mdoc: nullable MDoc writable
+ var mdoc: nullable MDoc is writable
end
# Is the mmodule created for internal purpose?
# Fictive module are instantied internally but they should not be
# exposed to the final user
- var is_fictive: Bool writable = false
+ var is_fictive: Bool = false is writable
redef fun parent_concern do return mgroup
end
# Is the property defined at the top_level of the module?
# Currently such a property are stored in `Object`
- var is_toplevel: Bool writable = false
+ var is_toplevel: Bool = false is writable
# Is the property a constructor?
# Warning, this property can be inherited by subclasses with or without being a constructor
# therefore, you should use `is_init_for` the verify if the property is a legal constructor for a given class
- var is_init: Bool writable = false
+ var is_init: Bool = false is writable
# The constructor is a (the) root init with empty signature but a set of initializers
- var is_root_init: Bool writable = false
+ var is_root_init: Bool = false is writable
# The the property a 'new' contructor?
- var is_new: Bool writable = false
+ var is_new: Bool = false is writable
# Is the property a legal constructor for a given class?
# As usual, visibility is not considered.
end
# The signature attached to the property definition
- var msignature: nullable MSignature writable = null
+ var msignature: nullable MSignature = null is writable
# The signature attached to the `new` call on a root-init
# This is a concatenation of the signatures of the initializers
#
# REQUIRE `mproperty.is_root_init == (new_msignature != null)`
- var new_msignature: nullable MSignature writable = null
+ var new_msignature: nullable MSignature = null is writable
# List of initialisers to call in root-inits
#
var initializers = new Array[MProperty]
# Is the method definition abstract?
- var is_abstract: Bool writable = false
+ var is_abstract: Bool = false is writable
# Is the method definition intern?
- var is_intern writable = false
+ var is_intern = false is writable
# Is the method definition extern?
- var is_extern writable = false
+ var is_extern = false is writable
end
# A local definition of an attribute
end
# The static type of the attribute
- var static_mtype: nullable MType writable = null
+ var static_mtype: nullable MType = null is writable
end
# A local definition of a virtual type
end
# The bound of the virtual type
- var bound: nullable MType writable = null
+ var bound: nullable MType = null is writable
# Is the bound fixed?
- var is_fixed writable = false
+ var is_fixed = false is writable
end
# A kind of class.
end
# Should groups be shown as clusters?
- var cluster_group writable = true
+ var cluster_group = true is writable
# Should projects be shown as clusters?
- var project_group writable = true
+ var project_group = true is writable
# Recursively generate noed ans clusters for a mroup
private fun dot_cluster(o: OStream, mgroup: MGroup)
redef var model: Model
# The root of the group tree
- var root: nullable MGroup writable = null
+ var root: nullable MGroup = null is writable
# The group tree, as a POSet
var mgroups = new POSet[MGroup]
fun is_root: Bool do return mproject.root == self
# The filepath (usualy a directory) of the group, if any
- var filepath: nullable String writable
+ var filepath: nullable String is writable
init (name: String, mproject: MProject, parent: nullable MGroup)
do
# see: `MConcernRankSorter`
# Use a positive booster to push down a result in the list
# A negative booster can be used to push up the result
- var booster_rank: Int writable = 0
+ var booster_rank: Int = 0 is writable
# Concern ranking used for ordering
# see: `MConcernRankSorter`
redef class MPropDef
# Does the MPropDef contains a call to super or a call of a super-constructor?
# Subsequent phases of the frontend (esp. typing) set it if required
- var has_supercall: Bool writable = false
+ var has_supercall: Bool = false is writable
end
redef class AClassdef
type MPROPDEF: MPropDef
# The associated propdef once build by a `ModelBuilder`
- var mpropdef: nullable MPROPDEF writable
+ var mpropdef: nullable MPROPDEF is writable
private fun build_property(modelbuilder: ModelBuilder, mclassdef: MClassDef) is abstract
private fun build_signature(modelbuilder: ModelBuilder) is abstract
var mlazypropdef: nullable MAttributeDef
# The associated getter (read accessor) if any
- var mreadpropdef: nullable MMethodDef writable
+ var mreadpropdef: nullable MMethodDef is writable
# The associated setter (write accessor) if any
- var mwritepropdef: nullable MMethodDef writable
+ var mwritepropdef: nullable MMethodDef is writable
redef fun build_property(modelbuilder, mclassdef)
do
# A multi-line string is recommmended.
#
# eg. `"Usage: tool [OPTION]... [FILE]...\nDo some things."`
- var tooldescription: String writable = "Usage: [OPTION]... [ARG]..."
+ var tooldescription: String = "Usage: [OPTION]... [ARG]..." is writable
# Does `process_options` should accept an empty sequence of arguments.
# ie. nothing except options.
# Is `false` by default.
#
# If required, if should be set by the client before calling `process_options`
- var accept_no_arguments writable = false
+ var accept_no_arguments = false is writable
# print the full usage of the tool.
# Is called by `process_option` on `--help`.
# The current `Career` of the character.
# Returns `null` if character is unemployed.
- var career: nullable Career writable = null
+ var career: nullable Career = null is writable
fun quit do
career = null