Enum bms_rs::lex::token::Token

source ·
pub enum Token<'a> {
Show 53 variants Artist(&'a str), AtBga { id: ObjId, source_bmp: ObjId, trim_top_left: (i16, i16), trim_size: (u16, u16), draw_point: (i16, i16), }, Banner(&'a Path), BackBmp(&'a Path), Bga { id: ObjId, source_bmp: ObjId, trim_top_left: (i16, i16), trim_bottom_right: (i16, i16), draw_point: (i16, i16), }, Bmp(Option<ObjId>, &'a Path), Bpm(&'a str), BpmChange(ObjId, &'a str), Case(u32), ChangeOption(ObjId, &'a str), Comment(&'a str), Def, Difficulty(u8), Else, ElseIf(u32), Email(&'a str), EndIf, EndRandom, EndSwitch, ExBmp(ObjId, Argb, &'a Path), ExRank(ObjId, JudgeLevel), ExWav(ObjId, [&'a str; 4], &'a Path), Genre(&'a str), If(u32), LnObj(ObjId), LnTypeRdm, LnTypeMgq, Maker(&'a str), Message { track: Track, channel: Channel, message: &'a str, }, MidiFile(&'a Path), OctFp, Option(&'a str), PathWav(&'a Path), Player(PlayerMode), PlayLevel(u8), PoorBga(PoorMode), Random(u32), Rank(JudgeLevel), SetRandom(u32), SetSwitch(u32), Skip, StageFile(&'a Path), Stop(ObjId, u32), SubArtist(&'a str), SubTitle(&'a str), Switch(u32), Text(ObjId, &'a str), Title(&'a str), Total(&'a str), Url(&'a str), VideoFile(&'a Path), VolWav(Volume), Wav(ObjId, &'a Path),
}
Expand description

A token of BMS format.

Variants§

§

Artist(&'a str)

#ARTIST [string]. Defines the artist name of the music.

§

AtBga

Fields

§id: ObjId

The id of the object to define.

§source_bmp: ObjId

The id of the object to be trimmed.

§trim_top_left: (i16, i16)

The top left point of the trim area in pixels.

§trim_size: (u16, u16)

The size of the trim area in pixels.

§draw_point: (i16, i16)

The top left point to be rendered in pixels.

#@BGA[01-ZZ] [01-ZZ] [sx] [sy] [w] [h] [dx] [dy]. Defines the image object from trimming the existing image object.

§

Banner(&'a Path)

#BANNER [filename]. Defines the banner image. This can be used on music select or result view. It should be 300x80.

§

BackBmp(&'a Path)

#BACKBMP [filename]. Defines the background image file of the play view. It should be 640x480. The effect will depend on the skin of the player.

§

Bga

Fields

§id: ObjId

The id of the object to define.

§source_bmp: ObjId

The id of the object to be trimmed.

§trim_top_left: (i16, i16)

The top left point of the trim area in pixels.

§trim_bottom_right: (i16, i16)

The bottom right point of the trim area in pixels.

§draw_point: (i16, i16)

The top left point to be rendered in pixels.

#BGA[01-ZZ] [01-ZZ] [x1] [y1] [x2] [y2] [dx] [dy]. Defines the image object from trimming the existing image object.

§

Bmp(Option<ObjId>, &'a Path)

#BMP[01-ZZ] [filename]. Defines the background image/movie object. The file specified may be not only BMP format, and also PNG, AVI, MP4, MKV and others. Its size should be less than or equal to 256x256. The black (#000000) pixel in the image will be treated as transparent. When the id 00 is specified, this first field will be None and the image will be shown when the player get mistaken.

§

Bpm(&'a str)

#BPM [f64]. Defines the base Beats-Per-Minute of the score. Defaults to 130, but some players don’t conform to it.

§

BpmChange(ObjId, &'a str)

#BPM[01-ZZ] [f64]. Defines the Beats-Per-Minute change object.

§

Case(u32)

#CASE [u32]. Starts a case scope if the integer equals to the generated random number. If there’s no #SKIP command in the scope, the parsing will fallthrough to the next #CASE or #DEF. See also Token::Switch.

§

ChangeOption(ObjId, &'a str)

#CHANGEOPTION[01-ZZ] [string]. Defines the play option change object. Some players interpret and apply the preferences.

§

Comment(&'a str)

#COMMENT [string]. Defines the text which is shown in the music select view. This may or may not be surrounded by double-quotes.

§

Def

#DEF. Starts a case scope if any #CASE had not matched to the generated random number. It must be placed in the end of the switch scope. See also Token::Switch.

§

Difficulty(u8)

#DIFFICULTY [1-5]. Defines the difficulty of the score. It can be used to sort the score having the same title.

§

Else

#ELSEIF [u32]. Starts an if scope when the preceding #IF had not matched to the generated random number. It must be in an if scope.

§

ElseIf(u32)

#ELSEIF [u32]. Starts an if scope when the integer equals to the generated random number. It must be in an if scope. If preceding #IF had matched to the generated, this scope don’t start. Syntax sugar for:

#ELSE
  #IF n
  // ...
  #ENDIF
#ENDIF
§

Email(&'a str)

%EMAIL [string]. The email address of this score file author.

§

EndIf

#ENDIF. Closes the if scope. See Token::If.

§

EndRandom

#ENDRANDOM. Closes the random scope. See Token::Random.

§

EndSwitch

#ENDSWITCH. Closes the random scope. See Token::Switch.

§

ExBmp(ObjId, Argb, &'a Path)

#BMP[01-ZZ] [0-255],[0-255],[0-255],[0-255] [filename]. Defines the background image/movie object with the color (alpha, red, green and blue) which will be treated as transparent.

§

ExRank(ObjId, JudgeLevel)

#EXRANK[01-ZZ] [0-3]. Defines the judgement level change object.

§

ExWav(ObjId, [&'a str; 4], &'a Path)

#EXWAV[01-ZZ] [parameter order] [pan or volume or frequency; 1-3] [filename]. Defines the key sound object with the effect of pan, volume and frequency.

§

Genre(&'a str)

#GENRE [string]. Defines the genre of the music.

§

If(u32)

#IF [u32]. Starts an if scope when the integer equals to the generated random number. This must be placed in a random scope. See also Token::Random.

§

LnObj(ObjId)

#LNOBJ [01-ZZ]. Declares the object as the end of an LN. The preceding object of the declared will be treated as the beginning of an LN.

§

LnTypeRdm

#LNTYPE 1. Declares the LN notation as the RDM type.

§

LnTypeMgq

#LNTYPE 2. Declares the LN notation as the MGQ type.

§

Maker(&'a str)

#MAKER [string]. Defines the author name of the score.

§

Message

Fields

§track: Track

The track, or measure, must start from 1. But some player may allow the 0 measure (i.e. Lunatic Rave 2).

§channel: Channel

The channel commonly expresses what the lane be arranged the note to.

§message: &'a str

The message to the channel.

#XXXYY:ZZ.... Defines the message which places the object onto the score. XXX is the track, YY is the channel, and ZZ... is the object id sequence.

§

MidiFile(&'a Path)

#MIDIFILE [filename]. Defines the MIDI file as the BGM. Deprecated

§

OctFp

#OCT/FP. Declares the score as the octave mode.

§

Option(&'a str)

#OPTION [string]. Defines the play option of the score. Some players interpret and apply the preferences.

§

PathWav(&'a Path)

#PATH_WAV [string]. Defines the root path of Token::Wav paths. This should be used only for tests.

§

Player(PlayerMode)

#PLAYER [1-4]. Defines the play style of the score.

§

PlayLevel(u8)

#PLAYLEVEL [integer]. Defines the difficulty level of the score. This can be used on music select view.

§

PoorBga(PoorMode)

#POORBGA [0-2]. Defines the display mode of the POOR BGA.

§

Random(u32)

#RANDOM [u32]. Starts a random scope which can contain only #IF-#ENDIF scopes. The random scope must close with #ENDRANDOM. A random integer from 1 to the integer will be generated when parsing the score. Then if the integer of #IF equals to the random integer, the commands in an if scope will be parsed, otherwise all command in it will be ignored. Any command except #IF and #ENDIF must not be included in the scope, but some players allow it.

§

Rank(JudgeLevel)

#RANK [0-3]. Defines the judgement level.

§

SetRandom(u32)

#SETRANDOM [u32]. Starts a random scope but the integer will be used as the generated random number. It should be used only for tests.

§

SetSwitch(u32)

#SETSWITCH [u32]. Starts a switch scope but the integer will be used as the generated random number. It should be used only for tests.

§

Skip

#SKIP. Escapes the current switch scope. It is often used in the end of every case scope.

§

StageFile(&'a Path)

#STAGEFILE [filename]. Defines the splashscreen image. It should be 640x480.

§

Stop(ObjId, u32)

#STOP[01-ZZ] [0-4294967295]. Defines the stop object. The scroll will stop the beats of the integer divided by 192. A beat length depends on the current BPM. If there are other objects on same time, the stop object must be evaluated at last.

§

SubArtist(&'a str)

#SUBARTIST [string]. Defines the sub-artist name of the music.

§

SubTitle(&'a str)

#SUBTITLE [string]. Defines the subtitle of the music.

§

Switch(u32)

#SWITCH [u32]. Starts a switch scope which can contain only #CASE or #DEF scopes. The switch scope must close with #ENDSW. A random integer from 1 to the integer will be generated when parsing the score. Then if the integer of #CASE equals to the random integer, the commands in a case scope will be parsed, otherwise all command in it will be ignored. Any command except #CASE and #DEF must not be included in the scope, but some players allow it.

§

Text(ObjId, &'a str)

#TEXT[01-ZZ] string. Defines the text object.

§

Title(&'a str)

#TITLE [string]. Defines the title of the music.

§

Total(&'a str)

#TOTAL [f64]. Defines the total gauge percentage when all notes is got as PERFECT.

§

Url(&'a str)

%URL [string]. The url of this score file.

§

VideoFile(&'a Path)

#VIDEOFILE [filename] / #MOVIE [filename]. Defines the background movie file. The audio track in the movie file should not be played. The play should start from the track 000.

§

VolWav(Volume)

#VOLWAV [0-255]. Defines the relative volume percentage of the sound in the score.

§

Wav(ObjId, &'a Path)

#WAV[01-ZZ] [filename]. Defines the key sound object. When same id multiple objects ring at same time, it must be played only one. The file specified may be not only WAV format, and also OGG, MP3 and others.

Trait Implementations§

source§

impl<'a> Clone for Token<'a>

source§

fn clone(&self) -> Token<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for Token<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Hash for Token<'a>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<'a> PartialEq<Token<'a>> for Token<'a>

source§

fn eq(&self, other: &Token<'a>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> Eq for Token<'a>

source§

impl<'a> StructuralEq for Token<'a>

source§

impl<'a> StructuralPartialEq for Token<'a>

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Token<'a>

§

impl<'a> Send for Token<'a>

§

impl<'a> Sync for Token<'a>

§

impl<'a> Unpin for Token<'a>

§

impl<'a> UnwindSafe for Token<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.