pub struct PercentForbidden {
pub suggestion: String,
pub comment_start: Option<String>,
}Expand description
The error that is reported when a lone % appears in the source under
parsing settings that forbid it (id flm.lang.percent-forbidden).
A lone % is forbidden unless it starts a comment, that is, unless comments
are on and the comment prefix is %
(FlmParsing::percent_forbidden).
Under the default parsing settings, the comment prefix is %%, and a lone
% is therefore forbidden. A lone % is ambiguous: it can be meant as a
percent sign or as the start of a comment. The author writes \% for a
percent sign, as in add 10\% to the total, and the comment prefix, e.g.
%%, to start a comment.
Reported by the parser when it reads the %. The % is kept in the text as
an ordinary character, and the parse continues.
Fields§
§suggestion: StringThe text that the message gives after “use”: the syntax for a percent
sign and for a comment, as returned by PercentForbidden::suggestion.
comment_start: Option<String>The comment prefix under the parsing settings of the file in which the
% appears, or None if no comment is recognized in this file. An
included file can have parsing settings of its own.
Implementations§
Source§impl PercentForbidden
impl PercentForbidden
Sourcepub fn suggestion(comment_start: Option<&str>) -> String
pub fn suggestion(comment_start: Option<&str>) -> String
Returns the text of the suggestion field for the comment prefix
comment_start.
The text gives \% for a percent sign. If comment_start is Some,
the text also gives the comment prefix for a comment. comment_start is
None when comments are off or the comment prefix is empty; see
FlmParsing::comment_start.
The wording of this text may change between versions. A program that
inspects the condition should read the comment_start field.
Trait Implementations§
Source§impl Clone for PercentForbidden
impl Clone for PercentForbidden
Source§impl Debug for PercentForbidden
impl Debug for PercentForbidden
Source§impl DiagnosticInfo for PercentForbidden
impl DiagnosticInfo for PercentForbidden
Source§const IDENTIFIER: &'static str = "flm.lang.percent-forbidden"
const IDENTIFIER: &'static str = "flm.lang.percent-forbidden"
<crate-or-lang>.<area>.<condition>. Read moreSource§fn serializable_data(&self) -> DiagnosticValue
fn serializable_data(&self) -> DiagnosticValue
Source§fn identifier(&self) -> &str
fn identifier(&self) -> &str
Source§impl Display for PercentForbidden
impl Display for PercentForbidden
impl Eq for PercentForbidden
Source§impl PartialEq for PercentForbidden
impl PartialEq for PercentForbidden
impl StructuralPartialEq for PercentForbidden
Auto Trait Implementations§
impl Forget for PercentForbidden
impl Freeze for PercentForbidden
impl Move for PercentForbidden
impl RefUnwindSafe for PercentForbidden
impl Send for PercentForbiddenwhere
RawVecInner: Send,
impl Sync for PercentForbiddenwhere
RawVecInner: Sync,
impl Unpin for PercentForbidden
impl UnsafeUnpin for PercentForbidden
impl UnwindSafe for PercentForbiddenwhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DiagnosticData for Twhere
T: DiagnosticInfo,
impl<T> DiagnosticData for Twhere
T: DiagnosticInfo,
Source§fn identifier(&self) -> &str
fn identifier(&self) -> &str
DiagnosticInfo::identifier — for every
ordinary condition, the IDENTIFIER const).Source§fn serializable_data(&self) -> DiagnosticValue
fn serializable_data(&self) -> DiagnosticValue
DiagnosticInfo::serializable_data).Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more