MCPcopy Index your code
hub / github.com/stemkoski/stemkoski.github.com / parse_decl

Function parse_decl

MathBox/mathbox-core.js:33127–33264  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33125 }
33126
33127 function parse_decl() {
33128 var stmt = state[0]
33129
33130 return stative(
33131 invariant_or_not,
33132 storage_or_not,
33133 parameter_or_not,
33134 precision_or_not,
33135 struct_or_type,
33136 maybe_name,
33137 maybe_lparen, // lparen means we're a function
33138 is_decllist,
33139 done
33140 )()
33141
33142 function invariant_or_not() {
33143 if(token.data === 'invariant') {
33144 if(stmt.flags & DECL_ALLOW_INVARIANT) {
33145 state.unshift(keyword())
33146 return Advance
33147 } else {
33148 return unexpected('`invariant` is not allowed here')
33149 }
33150 } else {
33151 state.fake(mknode(PLACEHOLDER, {data: '', position: token.position}))
33152 return Advance
33153 }
33154 }
33155
33156 function storage_or_not() {
33157 if(is_storage(token)) {
33158 if(stmt.flags & DECL_ALLOW_STORAGE) {
33159 state.unshift(keyword())
33160 return Advance
33161 } else {
33162 return unexpected('storage is not allowed here')
33163 }
33164 } else {
33165 state.fake(mknode(PLACEHOLDER, {data: '', position: token.position}))
33166 return Advance
33167 }
33168 }
33169
33170 function parameter_or_not() {
33171 if(is_parameter(token)) {
33172 if(!(stmt.flags & DECL_NO_INOUT)) {
33173 state.unshift(keyword())
33174 return Advance
33175 } else {
33176 return unexpected('parameter is not allowed here')
33177 }
33178 } else {
33179 state.fake(mknode(PLACEHOLDER, {data: '', position: token.position}))
33180 return Advance
33181 }
33182 }
33183
33184 function precision_or_not() {

Callers 1

writeFunction · 0.70

Calls 1

stativeFunction · 0.70

Tested by

no test coverage detected